- Mailing Lists
- Contributors
- Re: Is there a way to create account.analytic.line from stock.move?
Archives
- By thread 1419
-
By date
- August 2019 59
- September 2019 118
- October 2019 165
- November 2019 97
- December 2019 35
- January 2020 58
- February 2020 204
- March 2020 121
- April 2020 172
- May 2020 50
- June 2020 158
- July 2020 85
- August 2020 94
- September 2020 193
- October 2020 277
- November 2020 100
- December 2020 159
- January 2021 38
- February 2021 87
- March 2021 146
- April 2021 73
- May 2021 90
- June 2021 86
- July 2021 123
- August 2021 50
- September 2021 68
- October 2021 66
- November 2021 74
- December 2021 75
- January 2022 98
- February 2022 77
- March 2022 68
- April 2022 31
- May 2022 59
- June 2022 87
- July 2022 141
- August 2022 38
- September 2022 73
- October 2022 152
- November 2022 39
- December 2022 50
- January 2023 93
- February 2023 49
- March 2023 106
- April 2023 47
- May 2023 69
- June 2023 92
- July 2023 64
- August 2023 103
- September 2023 91
- October 2023 101
- November 2023 94
- December 2023 46
- January 2024 75
- February 2024 79
- March 2024 104
- April 2024 63
- May 2024 40
- June 2024 160
- July 2024 80
- August 2024 70
- September 2024 62
- October 2024 121
- November 2024 117
- December 2024 89
- January 2025 59
- February 2025 104
- March 2025 96
- April 2025 107
- May 2025 52
- June 2025 72
- July 2025 60
- August 2025 81
- September 2025 124
- October 2025 63
- November 2025 22
Contributors
Re: Is there a way to create account.analytic.line from stock.move?
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
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe
by Aarón Henríquez - 10:40 - 8 Oct 2020
Reference
-
Is there a way to create account.analytic.line from stock.move?
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
by Radovan Skolnik - 10:15 - 8 Oct 2020-
Re: Is there a way to create account.analytic.line from stock.move?
Reading all the code I got all confused - you're right it's there in stock_account.
Initially I wanted to report that the code you provided does not seem to work for me - the stock move inside stock picking associated with Sale Order does not receive analytical account information. But I found the culprit later on. The part of code that I initially thought is alredy present in procurement_mto_analytic is this:
def _prepare_procurement_values(self, group_id=False):
res = super()._prepare_procurement_values(group_id)
res.update({"account_analytic_id": self.order_id.analytic_account_id.id})
return res
However what you posted was this:res.update({"analytic_account_id": self.order_id.analytic_account_id.id})
In stock_analytic (in fact in sale) the field is named analytic_account_id but in procurement_mto_analytic it's account_analytic_id. I missed this detail initially and of course it didn't work. Throughout the codebase of stock Odoo both names are used for some reason. The same goes for account-analytic OCA repository.
Best regards
Radovan
On pondelok 12. októbra 2020 17:02:34 CEST Dominique k wrote:
> look at the module stock_account
> Regards, Dominique
> On Mon, 12 Oct 2020 at 20:05, Radovan Skolnik < radovan@skolnik.info [1] >
> wrote: Oh, now I see (after long staring at various pieces of code).
> Account Move (account.move) ensures creation of Analytic Entries
> (account.analytic.line) for Account Move Lines (account.move.line) that are
> validated. So that way OCA module stock_analytic provides the possibility
> to create Analytic Entries in _prepare_account_move_line method...
>
> OK, now I'll update the code of procurement_mto_analytic (actually only the
> second part as the first part is there already - or should that be another
> module or even a new one?) with the code you provided, the analytical
> account value should be propagated into stock move lines. Now does stock
> move somehow relate to account move (to generate analytic entries)? Does
> not seem to me so...
>
> Thank you very much for info. Best regards
>
> Radovan
>
> On pondelok 12. októbra 2020 12:26:51 CEST Dominique k wrote:
> > in odoo standard, analytic entries (account.analytic.line) are generated
> > with journal entries (== invoices in v13 onwards). It is also possible to
> > create analytic entries separately, typically with timesheet. In fact
> > timesheet entries are analytic lines with the OCA module stock_analytic,
> > analytic entries are created when a stock move is validated. that is all
> > as
> > far as i know. other modules, do not generate analytic lines, instead,
> > they
> > add an analytic account to a document, which eventually ends up/link up
> > as/with a timesheet, an invoice or a stock move. Regards, Dominique
> > _______________________________________________
> > Mailing-List: https://odoo-community.org/groups/contributors-15 [2] [1]
> > Post to: mailto: contributors@odoo-community.org [3]
> > Unsubscribe: https://odoo-community.org/groups?unsubscribe [4] [2]
> >
> >
> >
> > [1] https://odoo-community.org/groups/contributors-15 [5]
> > [2] https://odoo-community.org/groups?unsubscribe [6]
>
> _______________________________________________
> Mailing-List: https://odoo-community.org/groups/contributors-15 [7]
> Post to: mailto:contributors@odoo-community.org
> Unsubscribe: https://odoo-community.org/groups?unsubscribe [8]
>
>
>
> [1] mailto:radovan@skolnik.info
> [2] https://odoo-community.org/groups/contributors-15
> [3] mailto:contributors@odoo-community.org
> [4] https://odoo-community.org/groups?unsubscribe
> [5] https://odoo-community.org/groups/contributors-15
> [6] https://odoo-community.org/groups?unsubscribe
> [7] https://odoo-community.org/groups/contributors-15
> [8] https://odoo-community.org/groups?unsubscribe
by Radovan Skolnik - 09:21 - 12 Oct 2020 -
Re: Is there a way to create account.analytic.line from stock.move?
look at the module stock_accountRegards,DominiqueOn Mon, 12 Oct 2020 at 20:05, Radovan Skolnik <radovan@skolnik.info> wrote:Oh, now I see (after long staring at various pieces of code). Account Move
(account.move) ensures creation of Analytic Entries (account.analytic.line)
for Account Move Lines (account.move.line) that are validated. So that way OCA
module stock_analytic provides the possibility to create Analytic Entries in
_prepare_account_move_line method...
OK, now I'll update the code of procurement_mto_analytic (actually only the
second part as the first part is there already - or should that be another
module or even a new one?) with the code you provided, the analytical account
value should be propagated into stock move lines. Now does stock move somehow
relate to account move (to generate analytic entries)? Does not seem to me
so...
Thank you very much for info. Best regards
Radovan
On pondelok 12. októbra 2020 12:26:51 CEST Dominique k wrote:
> in odoo standard, analytic entries (account.analytic.line) are generated
> with journal entries (== invoices in v13 onwards). It is also possible to
> create analytic entries separately, typically with timesheet. In fact
> timesheet entries are analytic lines with the OCA module stock_analytic,
> analytic entries are created when a stock move is validated. that is all as
> far as i know. other modules, do not generate analytic lines, instead, they
> add an analytic account to a document, which eventually ends up/link up
> as/with a timesheet, an invoice or a stock move. Regards, Dominique
> _______________________________________________
> Mailing-List: https://odoo-community.org/groups/contributors-15 [1]
> Post to: mailto:contributors@odoo-community.org
> Unsubscribe: https://odoo-community.org/groups?unsubscribe [2]
>
>
>
> [1] https://odoo-community.org/groups/contributors-15
> [2] https://odoo-community.org/groups?unsubscribe
by dominique.k - 05:01 - 12 Oct 2020 -
Re: Is there a way to create account.analytic.line from stock.move?
Oh, now I see (after long staring at various pieces of code). Account Move (account.move) ensures creation of Analytic Entries (account.analytic.line) for Account Move Lines (account.move.line) that are validated. So that way OCA module stock_analytic provides the possibility to create Analytic Entries in _prepare_account_move_line method... OK, now I'll update the code of procurement_mto_analytic (actually only the second part as the first part is there already - or should that be another module or even a new one?) with the code you provided, the analytical account value should be propagated into stock move lines. Now does stock move somehow relate to account move (to generate analytic entries)? Does not seem to me so... Thank you very much for info. Best regards Radovan On pondelok 12. októbra 2020 12:26:51 CEST Dominique k wrote: > in odoo standard, analytic entries (account.analytic.line) are generated > with journal entries (== invoices in v13 onwards). It is also possible to > create analytic entries separately, typically with timesheet. In fact > timesheet entries are analytic lines with the OCA module stock_analytic, > analytic entries are created when a stock move is validated. that is all as > far as i know. other modules, do not generate analytic lines, instead, they > add an analytic account to a document, which eventually ends up/link up > as/with a timesheet, an invoice or a stock move. Regards, Dominique > _______________________________________________ > Mailing-List: https://odoo-community.org/groups/contributors-15 [1] > Post to: mailto:contributors@odoo-community.org > Unsubscribe: https://odoo-community.org/groups?unsubscribe [2] > > > > [1] https://odoo-community.org/groups/contributors-15 > [2] https://odoo-community.org/groups?unsubscribe
by Radovan Skolnik - 02:05 - 12 Oct 2020 -
Re: Is there a way to create account.analytic.line from stock.move?
in odoo standard, analytic entries (account.analytic.line) are generated with journal entries (== invoices in v13 onwards).It is also possible to create analytic entries separately, typically with timesheet. In fact timesheet entries are analytic lineswith the OCA module stock_analytic, analytic entries are created when a stock move is validated.that is all as far as i know.other modules, do not generate analytic lines, instead, they add an analytic account to a document, which eventually ends up/link up as/with a timesheet, an invoice or a stock move.Regards,Dominique
by dominique.k - 12:25 - 12 Oct 2020 -
Re: Is there a way to create account.analytic.line from stock.move?
Which OCA module generates analytic entries (is the same as Analytic Items - i.e. account.analytic.line)? Radovan On pondelok 12. októbra 2020 12:00:27 CEST Dominique k wrote: > 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
by Radovan Skolnik - 12:11 - 12 Oct 2020
-