Skip to content

Commit

Permalink
[14.0][MIG] purchase_force_invoiced: Migration to 14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Reyes4711-S73 committed Nov 18, 2021
1 parent c0facfb commit 3f69a95
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion purchase_force_invoiced/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name": "Purchase Force Invoiced",
"summary": "Allows to force the billing status of the purchase order to "
'"Invoiced"',
"version": "13.0.1.0.0",
"version": "14.0.1.0.0",
"author": "Forgeflow, Odoo Community Association (OCA)",
"category": "Purchase Management",
"license": "AGPL-3",
Expand Down
15 changes: 2 additions & 13 deletions purchase_force_invoiced/model/purchase.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class PurchaseOrder(models.Model):
copy=False,
help="When you set this field, the purchase order will be "
"considered as fully billed, even when there may be ordered "
"or delivered quantities pending to bill.",
"or delivered quantities pending to bill. To use this field, "
"the order must be in 'Locked' state",
)

@api.depends("force_invoiced")
Expand All @@ -23,15 +24,3 @@ def _get_invoiced(self):
lambda po: po.force_invoiced and po.invoice_status == "to invoice"
):
order.invoice_status = "invoiced"


class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"

def _prepare_account_move_line(self, line):
res = super(PurchaseOrderLine, self)._prepare_account_move_line(line)
if res.get("purchase_line_id", False):
pol = self.browse(res["purchase_line_id"])
if pol.order_id.force_invoiced:
res["quantity"] = 0.0
return res
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def _create_product(self, name, product_ctg):

def _create_invoice_from_purchase(self, purchase):
invoice = self.account_invoice_model.create(
{"partner_id": purchase.partner_id.id, "type": "in_invoice"}
{"partner_id": purchase.partner_id.id, "move_type": "in_invoice"}
)
invoice.write({"purchase_id": purchase.id})
invoice._onchange_purchase_auto_complete()
Expand Down

0 comments on commit 3f69a95

Please sign in to comment.