-
-
Notifications
You must be signed in to change notification settings - Fork 692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[16.0][MIG] stock_picking_invoicing: Migration to 16.0 #1465
[16.0][MIG] stock_picking_invoicing: Migration to 16.0 #1465
Conversation
Thanks @mbcosta you beat me to it I was planning to work on this next week :) "To avoid error in the Views with the Group parameter, I'm just create a simply method to check if the user has the group Account" I think this is a little bit overkill and it seems that the standard "odoo way" of doing it is to simply add the field a second time with invisible="1". It mentioned in the comments of this PR odoo/odoo#95729 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG thanks
def _get_taxes(self, fiscal_position, inv_type): | ||
""" | ||
Map product taxes based on given fiscal position | ||
:param fiscal_position: account.fiscal.position recordset | ||
:param inv_type: string | ||
:return: account.tax recordset | ||
""" | ||
product = self.mapped("product_id") | ||
product.ensure_one() | ||
if inv_type in ("out_invoice", "out_refund"): | ||
taxes = product.taxes_id | ||
else: | ||
taxes = product.supplier_taxes_id | ||
company_id = self.env.context.get("force_company", self.env.company.id) | ||
my_taxes = taxes.filtered(lambda r: r.company_id.id == company_id) | ||
return fiscal_position.map_tax(my_taxes) | ||
|
||
@api.model | ||
def _get_account(self, fiscal_position, account): | ||
""" | ||
Map the given account with given fiscal position | ||
:param fiscal_position: account.fiscal.position recordset | ||
:param account: account.account recordset | ||
:return: account.account recordset | ||
""" | ||
return fiscal_position.map_account(account) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems it's not used anymore
* Loading * Onchanges Etc
* Good Price with pricelist * Good Taxes * group works * Everything is filtered with company
* Get the correct taxes and account regarding Fiscal Position
9675abd
to
01d3142
Compare
About the last changes:
And include onchage method to update the Invoice State when the field in the Picking are changed
-Refactoring Tests by create methods to avoid duplicate code and, as said before, included tests for Price Unit cases. |
389903b
to
76f259b
Compare
We should avaliate the necessity of the Buttons "Set Invoiced" and "Set Not Billable" in Picking View. In my opinion the case of Not Billable is valide to allow users "fix" when a Picking was wrong marked "To Be Invoiced", I'm not certain about the case of "Invoiced", in which cases it will be use. |
…ence true if value not get in vals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code+functional review, but I think it's more standard procedure to squash most of these migration commits unless they are adding new features
a86ecf5, e713989, 5ed7932, 473c119, b0d65e7, 273d4cb, 76f387f and 76f259b could all be squashed as generic migration
6af8bb2 and 573b5a2 i think are fine as is seperately as new features
:param invoice: account.move | ||
:return: dict | ||
""" | ||
name = ", ".join(moves.mapped("name")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi, @mbcosta we found a problem when invoicing a picking with multiple moves with the same product it duplicates the name of the product in the invoice line and if we have the group = "partner_product" . We think that if changing this line to only get the first move's description if using the partner_prooduct option should avoid the issue.
…group(s)' when field has parameter Groups and are used in for defined an attribute/attrs in the Views and included the dependency of base_view_inheritance_extension module.
…voice consider the value of Product Pricelist or the Seller Price, changed Demo Data for tests.
…al=Hide), to allow users view or, if necessary, change the value.
…o the users be able setting Invoice State to Invoiced or Not Billable, also included onchange method to update this field in Move Lines when changed in Picking.
…d error of Tracking by Lot when MRP module are installed, but use a Product with BoM and Route Buy.
…licate code and included tests for the cases when Price Unit are Informed by User, Sellers and Pricelist.
…Line when Grouping Pickings by Partner/Product.
76f259b
to
95d4cd3
Compare
Thanks @hildickethan-S73 @adrip-s73 for your review, about the problems:
commit 8c69b40 has a different author
In the last commit I tried to fix it, I let separated commit to allow a backport, if necessary, or to made some change after reviews. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ocabot merge nobump |
This PR looks fantastic, let's merge it! |
Congratulations, your PR was merged at 47cd67c. Thanks a lot for contributing to OCA. ❤️ |
thank all for review, if you find some problem or has a doubt about this module please mark me in the issue or PR, I have worked in this module for a while because it's important for Brazilian Localization so we need to keep it functional, but we also work to keep compatible with another countries. |
thank you @mbcosta for your work ! |
Standard migration of stock_picking_invoicing to v16, #1250 some changes was necessary:
Field 'invoice_state' used in attrs ({'invisible': [('invoice_state', 'in', [False, 'none'])]}) is restricted to the group(s) account.group_account_invoice.
Removed get Price Unit for Invoice methods, because the field become compute in the account.move.line https://github.com/OCA/OCB/blob/16.0/addons/account/models/account_move_line.py#L330
Refund cases can has Local Origin Usage as Customer and Internal
Included onchange methods to the simulation the creation of the Invoice
In the cases of Reversal Moves is necessary link the account.move.lines with the stock.move related because the field picking_ids in account.move become compute https://github.com/OCA/stock-logistics-workflow/blob/16.0/stock_picking_invoice_link/models/account_move.py#L18
This PR should be replace #1449 because it's based in the v15 and by the tests I'm made with demo data the module are working as expect.
cc @renatonlima @rvalyi @jguenat