Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: Is there a way to create account.analytic.line from stock.move?

by
dominique.k
- 12/10/2020 12:00:27
I haven't looked at all of the modules related to analytic in OCA.
In general, the analytic entries are created by invoices, timesheets (odoo standard), and stock move (with OCA module)

however, in order to have the analytic entries, you must first indicate the analytic account on the "originator" document. Hence, whenever there is a new module, you may want to add an analytic account. e.g. stock_request, or purchase_request etc..
or whatever module you are building:
subscription, contract, team etc...

Regards,
Dominique


On Mon, 12 Oct 2020 at 17:38, Radovan Skolnik <radovan@skolnik.info> wrote:
Great! Thank you very much Dominique.

One more question: as I explained before I want to use this to produce
account.analytic.line records to get costs and revenues of cases / project. I
see lots of modules in OCA/account-analytic that allow adding analytic account
info to various objects. What is the general idea on using this information?
Is it creation of those account.analytic.line - i.e. Analytic Items? If so,
how are they generated? Or am I missing something here?

Best regards

        Radovan

On pondelok 12. októbra 2020 11:32:38 CEST Dominique k wrote:
> indeed. We added few lines of code to propagate the analytic account from SO
> to stock move. Not sure why it is not a module in OCA. May be because it is
> very small, and has to rely on a "glue" module ('sale_stock') Anyway, if
> you add this (v13), in your code, it would work. (you also need to add a
> dependency to 'sale_stock' in your manifest class
> SaleOrderLine(models.Model):
> _inherit = 'sale.order.line'
> def _prepare_procurement_values(self, group_id=False):
> res = super(SaleOrderLine,
> self)._prepare_procurement_values(group_id=group_id) analytic_id =
> self.order_id.analytic_account_id
> res['analytic_account_id'] = analytic_id and analytic_id.id [1] or False
> return res
>
> class StockRule(models.Model):
> _inherit = 'stock.rule'
> def _get_custom_move_fields(self):
> fields = super(StockRule, self)._get_custom_move_fields()
> fields += ['analytic_account_id']
> return fields
> Regards, Dominique
> On Mon, 12 Oct 2020 at 16:57, Radovan Skolnik < radovan@skolnik.info [2] >
> wrote: Aaron,
> I cannot seem to get analytic_account_id propagated from SO to outgoing
> stock moves (also from PO to incoming stock moves). Is that supposed to
> work that way? When PO is created from SO the value is propagated there
> though. Best regards
> Radovan
>
> On štvrtok 8. októbra 2020 17:52:24 CEST Aarón Henríquez Quintana wrote:
> > Yes, sorry for that. It only creates analytic entries if you use real time
> > inventory valuation. Regards.
> > On Thu, 8 Oct 2020 at 13:52, Radovan Skolnik <  radovan@skolnik.info [3]
> > [1] > wrote: Thanx Aaron for info. But do I understand it correctly that
> > this only propagates analytic account value into different objects but
> > does not create account.analytic.line records? I need to get cost of
> > products into them as negative amounts to be able to calulate
> > profitability of analytic account. Best regards
> > Radovan
> >
> > On štvrtok 8. októbra 2020 10:42:06 CEST Aarón Henríquez Quintana wrote:
> > > Yes. It is possible. You need a couple of modules:
> > >  https://apps.odoo.com/apps/modules/12.0/stock_analytic/ [4] [2] [1]
> > >  adds the> >
> > > analytic account to the stock move.
> > >
> > >  https://github.com/ForgeFlow/eficent-odoo-addons/tree/12.0/purchase_sto
> > >  ck [5]> >
> > > _a [3]>
> > > nalytic [2] I use this for passing the analytic form the PO lines to the
> > > stock moves. I think there is a similar one in the OCA apps but I don't
> > > remember what it is called.
> > >
> > >  https://github.com/OCA/account-analytic/tree/12.0/procurement_mto_analy
> > >  ti [6]> >
> > > c [4]>
> > > [3] To pass the analytic information from the SO to the stock moves of
> > > the
> > > delivery. Regards.
> > > On Thu, 8 Oct 2020 at 10:17, Radovan Skolnik <  radovan@skolnik.info [7]
> > > [5] [4] > wrote: Hello,
> > > we would like to use analytic accounts to track profitability of
> > > individual
> > > sales. So I'd setup automatic creation of analytic account on confirmed
> > > sale orders which would be propagated to invoices. This would cover the
> > > credit side. What I am struggling with is the debit side - i.e. costs of
> > > products. One way would be adding analytic account on POs/POLs but that
> > > is not feasible because we can have products in stock from past which we
> > > decide to sell. So my idea is to generate account.analytic.line records
> > > from stock.moves and assign them value according to average value. Are
> > > there any modules that would support this? Or should I choose different
> > > approach? Thank you. Best regards
> > > Radovan Skolnik
> > >
> > >
> > > _______________________________________________
> > > Mailing-List:  https://odoo-community.org/groups/contributors-15 [8] [6]
> > > [5] Post to: mailto:  contributors@odoo-community.org [9] [7] [6]
> > > Unsubscribe:  https://odoo-community.org/groups?unsubscribe [10] [8] [7]
> > >
> > >
> > > _______________________________________________
> > > Mailing-List:  https://odoo-community.org/groups/contributors-15 [11]
> > > [9] [8] Post to: mailto:  contributors@odoo-community.org [12] [10]
> > > Unsubscribe:  https://odoo-community.org/groups?unsubscribe [13] [11]
> > > [9]
> > >
> > >
> > >
> > > [1]  https://apps.odoo.com/apps/modules/12.0/stock_analytic/ [14] [12]
> > > [2]
> > >
> > >  https://github.com/ForgeFlow/eficent-odoo-addons/tree/12.0/purchase_sto
> > >  ck [15]> >
> > > _a [13]>
> > > nalytic [3]
> > >
> > >  https://github.com/OCA/account-analytic/tree/12.0/procurement_mto_analy
> > >  ti [16]> >
> > > c [14]>
> > > [4] mailto:  radovan@skolnik.info [17] [15]
> > > [5]  https://odoo-community.org/groups/contributors-15 [18] [16]
> > > [6] mailto:  contributors@odoo-community.org [19] [17]
> > > [7]  https://odoo-community.org/groups?unsubscribe [20] [18]
> > > [8]  https://odoo-community.org/groups/contributors-15 [21] [19]
> > > [9]  https://odoo-community.org/groups?unsubscribe [22] [20]
> >
> > _______________________________________________
> > Mailing-List:  https://odoo-community.org/groups/contributors-15 [23] [21]
> > Post to: mailto:  contributors@odoo-community.org [24] [22]
> > Unsubscribe:  https://odoo-community.org/groups?unsubscribe [25] [23]
> >
> >
> > _______________________________________________
> > Mailing-List:  https://odoo-community.org/groups/contributors-15 [26] [24]
> > Post to: mailto: contributors@odoo-community.org [27]
> > Unsubscribe:  https://odoo-community.org/groups?unsubscribe [28] [25]
> >
> >
> >
> > [1] mailto: radovan@skolnik.info [29]
> > [2]  https://apps.odoo.com/apps/modules/12.0/stock_analytic/ [30]
> > [3]
> >
> >  https://github.com/ForgeFlow/eficent-odoo-addons/tree/12.0/purchase_stock
> >  _a [31]>
> > [4]
> >
> >  https://github.com/OCA/account-analytic/tree/12.0/procurement_mto_analyti
> >  c [32]>
> > [5] mailto: radovan@skolnik.info [33]
> > [6]  https://odoo-community.org/groups/contributors-15 [34]
> > [7] mailto: contributors@odoo-community.org [35]
> > [8]  https://odoo-community.org/groups?unsubscribe [36]
> > [9]  https://odoo-community.org/groups/contributors-15 [37]
> > [10] mailto: contributors@odoo-community.org [38]
> > [11]  https://odoo-community.org/groups?unsubscribe [39]
> > [12]  https://apps.odoo.com/apps/modules/12.0/stock_analytic/ [40]
> > [13]
> >
> >  https://github.com/ForgeFlow/eficent-odoo-addons/tree/12.0/purchase_stock
> >  _a [41]>
> > [14]
> >
> >  https://github.com/OCA/account-analytic/tree/12.0/procurement_mto_analyti
> >  c [42]>
> > [15] mailto: radovan@skolnik.info [43]
> > [16]  https://odoo-community.org/groups/contributors-15 [44]
> > [17] mailto: contributors@odoo-community.org [45]
> > [18]  https://odoo-community.org/groups?unsubscribe [46]
> > [19]  https://odoo-community.org/groups/contributors-15 [47]
> > [20]  https://odoo-community.org/groups?unsubscribe [48]
> > [21]  https://odoo-community.org/groups/contributors-15 [49]
> > [22] mailto: contributors@odoo-community.org [50]
> > [23]  https://odoo-community.org/groups?unsubscribe [51]
> > [24]  https://odoo-community.org/groups/contributors-15 [52]
> > [25]  https://odoo-community.org/groups?unsubscribe [53]
>
> _______________________________________________
> Mailing-List: https://odoo-community.org/groups/contributors-15 [54]
> Post to: mailto: contributors@odoo-community.org [55]
> Unsubscribe: https://odoo-community.org/groups?unsubscribe [56]
>
>
> _______________________________________________
> Mailing-List: https://odoo-community.org/groups/contributors-15 [57]
> Post to: mailto:contributors@odoo-community.org
> Unsubscribe: https://odoo-community.org/groups?unsubscribe [58]
>
>
>
> [1] http://analytic_id.id
> [2] mailto:radovan@skolnik.info
> [3] mailto:radovan@skolnik.info
> [4] https://apps.odoo.com/apps/modules/12.0/stock_analytic/
> [5]
> https://github.com/ForgeFlow/eficent-odoo-addons/tree/12.0/purchase_stock
> [6]
> https://github.com/OCA/account-analytic/tree/12.0/procurement_mto_analyti
> [7] mailto:radovan@skolnik.info
> [8] https://odoo-community.org/groups/contributors-15
> [9] mailto:contributors@odoo-community.org
> [10] https://odoo-community.org/groups?unsubscribe
> [11] https://odoo-community.org/groups/contributors-15
> [12] mailto:contributors@odoo-community.org
> [13] https://odoo-community.org/groups?unsubscribe
> [14] https://apps.odoo.com/apps/modules/12.0/stock_analytic/
> [15]
> https://github.com/ForgeFlow/eficent-odoo-addons/tree/12.0/purchase_stock
> [16]
> https://github.com/OCA/account-analytic/tree/12.0/procurement_mto_analyti
> [17] mailto:radovan@skolnik.info
> [18] https://odoo-community.org/groups/contributors-15
> [19] mailto:contributors@odoo-community.org
> [20] https://odoo-community.org/groups?unsubscribe
> [21] https://odoo-community.org/groups/contributors-15
> [22] https://odoo-community.org/groups?unsubscribe
> [23] https://odoo-community.org/groups/contributors-15
> [24] mailto:contributors@odoo-community.org
> [25] https://odoo-community.org/groups?unsubscribe
> [26] https://odoo-community.org/groups/contributors-15
> [27] mailto:contributors@odoo-community.org
> [28] https://odoo-community.org/groups?unsubscribe
> [29] mailto:radovan@skolnik.info
> [30] https://apps.odoo.com/apps/modules/12.0/stock_analytic/
> [31]
> https://github.com/ForgeFlow/eficent-odoo-addons/tree/12.0/purchase_stock_a
> [32]
> https://github.com/OCA/account-analytic/tree/12.0/procurement_mto_analytic
> [33] mailto:radovan@skolnik.info
> [34] https://odoo-community.org/groups/contributors-15
> [35] mailto:contributors@odoo-community.org
> [36] https://odoo-community.org/groups?unsubscribe
> [37] https://odoo-community.org/groups/contributors-15
> [38] mailto:contributors@odoo-community.org
> [39] https://odoo-community.org/groups?unsubscribe
> [40] https://apps.odoo.com/apps/modules/12.0/stock_analytic/
> [41]
> https://github.com/ForgeFlow/eficent-odoo-addons/tree/12.0/purchase_stock_a
> [42]
> https://github.com/OCA/account-analytic/tree/12.0/procurement_mto_analytic
> [43] mailto:radovan@skolnik.info
> [44] https://odoo-community.org/groups/contributors-15
> [45] mailto:contributors@odoo-community.org
> [46] https://odoo-community.org/groups?unsubscribe
> [47] https://odoo-community.org/groups/contributors-15
> [48] https://odoo-community.org/groups?unsubscribe
> [49] https://odoo-community.org/groups/contributors-15
> [50] mailto:contributors@odoo-community.org
> [51] https://odoo-community.org/groups?unsubscribe
> [52] https://odoo-community.org/groups/contributors-15
> [53] https://odoo-community.org/groups?unsubscribe
> [54] https://odoo-community.org/groups/contributors-15
> [55] mailto:contributors@odoo-community.org
> [56] https://odoo-community.org/groups?unsubscribe
> [57] https://odoo-community.org/groups/contributors-15
> [58] https://odoo-community.org/groups?unsubscribe




Reference