From da508b47fb3d172a47e25475b17db3146a9a9849 Mon Sep 17 00:00:00 2001
From: ps-tubtim
Date: Thu, 24 Oct 2019 10:22:26 +0700
Subject: [PATCH 001/210] [12.0][ADD] purchase_work_acceptance
---
purchase_work_acceptance/README.rst | 144 +++++
purchase_work_acceptance/__init__.py | 4 +
purchase_work_acceptance/__manifest__.py | 31 ++
.../data/work_acceptance_sequence.xml | 14 +
purchase_work_acceptance/models/__init__.py | 7 +
.../models/account_invoice.py | 74 +++
purchase_work_acceptance/models/purchase.py | 96 ++++
.../models/res_config_settings.py | 29 ++
.../models/stock_picking.py | 80 +++
.../models/work_acceptance.py | 224 ++++++++
purchase_work_acceptance/readme/CONFIGURE.rst | 30 ++
.../readme/CONTRIBUTORS.rst | 1 +
.../readme/DESCRIPTION.rst | 3 +
purchase_work_acceptance/readme/USAGE.rst | 26 +
.../security/ir.model.access.csv | 3 +
.../security/security.xml | 29 ++
.../static/description/icon.png | Bin 0 -> 9455 bytes
.../static/description/index.html | 493 ++++++++++++++++++
purchase_work_acceptance/tests/__init__.py | 3 +
.../tests/test_purchase_work_acceptance.py | 171 ++++++
.../views/account_invoice_views.xml | 22 +
.../views/purchase_views.xml | 37 ++
.../views/res_config_settings_views.xml | 44 ++
.../views/stock_picking_views.xml | 22 +
.../views/work_acceptance_views.xml | 137 +++++
purchase_work_acceptance/wizard/__init__.py | 3 +
.../wizard/select_work_acceptance_wizard.py | 41 ++
.../select_work_acceptance_wizard_views.xml | 27 +
28 files changed, 1795 insertions(+)
create mode 100644 purchase_work_acceptance/README.rst
create mode 100644 purchase_work_acceptance/__init__.py
create mode 100644 purchase_work_acceptance/__manifest__.py
create mode 100644 purchase_work_acceptance/data/work_acceptance_sequence.xml
create mode 100644 purchase_work_acceptance/models/__init__.py
create mode 100644 purchase_work_acceptance/models/account_invoice.py
create mode 100644 purchase_work_acceptance/models/purchase.py
create mode 100644 purchase_work_acceptance/models/res_config_settings.py
create mode 100644 purchase_work_acceptance/models/stock_picking.py
create mode 100644 purchase_work_acceptance/models/work_acceptance.py
create mode 100644 purchase_work_acceptance/readme/CONFIGURE.rst
create mode 100644 purchase_work_acceptance/readme/CONTRIBUTORS.rst
create mode 100644 purchase_work_acceptance/readme/DESCRIPTION.rst
create mode 100644 purchase_work_acceptance/readme/USAGE.rst
create mode 100644 purchase_work_acceptance/security/ir.model.access.csv
create mode 100644 purchase_work_acceptance/security/security.xml
create mode 100644 purchase_work_acceptance/static/description/icon.png
create mode 100644 purchase_work_acceptance/static/description/index.html
create mode 100644 purchase_work_acceptance/tests/__init__.py
create mode 100644 purchase_work_acceptance/tests/test_purchase_work_acceptance.py
create mode 100644 purchase_work_acceptance/views/account_invoice_views.xml
create mode 100644 purchase_work_acceptance/views/purchase_views.xml
create mode 100644 purchase_work_acceptance/views/res_config_settings_views.xml
create mode 100644 purchase_work_acceptance/views/stock_picking_views.xml
create mode 100644 purchase_work_acceptance/views/work_acceptance_views.xml
create mode 100644 purchase_work_acceptance/wizard/__init__.py
create mode 100644 purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
create mode 100644 purchase_work_acceptance/wizard/select_work_acceptance_wizard_views.xml
diff --git a/purchase_work_acceptance/README.rst b/purchase_work_acceptance/README.rst
new file mode 100644
index 00000000000..ad8bd431f7f
--- /dev/null
+++ b/purchase_work_acceptance/README.rst
@@ -0,0 +1,144 @@
+========================
+Purchase Work Acceptance
+========================
+
+.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ !! This file is generated by oca-gen-addon-readme !!
+ !! changes will be overwritten. !!
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
+ :target: https://odoo-community.org/page/development-status
+ :alt: Alpha
+.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
+ :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
+ :alt: License: AGPL-3
+.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
+ :target: https://github.com/OCA/purchase-workflow/tree/12.0/purchase_work_acceptance
+ :alt: OCA/purchase-workflow
+.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
+ :target: https://translation.odoo-community.org/projects/purchase-workflow-12-0/purchase-workflow-12-0-purchase_work_acceptance
+ :alt: Translate me on Weblate
+.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
+ :target: https://runbot.odoo-community.org/runbot/142/12.0
+ :alt: Try me on Runbot
+
+|badge1| |badge2| |badge3| |badge4| |badge5|
+
+This module introduces the ability to define a quantity control point on Receipts and Vendor Bills by
+Work Acceptance. Only the products and services that have been included in a Work Acceptance can be
+received and/or invoiced.
+
+.. IMPORTANT::
+ This is an alpha version, the data model and design can change at any time without warning.
+ Only for development or testing purpose, do not use in production.
+ `More details on development status `_
+
+**Table of contents**
+
+.. contents::
+ :local:
+
+Configuration
+=============
+
+** Show Button Create WA on Purchase Order **
+
+#. Go to *Purchase > Configuration > Settings*
+#. Check 'Enable WA on Purchase Order'
+
+** Show WA Reference fields on Receipt **
+
+#. Go to *Purchase > Configuration > Settings*
+#. Check 'Enable WA on Goods Receipt'
+
+** Control Receipt by Work Acceptance**
+
+#. Go to *Purchase > Configuration > Settings*
+#. Check 'Enforce WA on Goods Receipt'
+
+** Show WA Reference fields on Vendor Bill **
+
+#. Go to *Purchase > Configuration > Settings*
+#. Check 'Enable WA on Vendor Bill'
+
+** Control Vendor Bill by Work Acceptance**
+
+#. Go to *Purchase > Configuration > Settings*
+#. Check 'Enforce WA on Vendor Bill'
+
+Note:
+
+* You can check 'Enable WA on Goods Receipt' and 'Enable WA on Vendor Bill' after checked 'Enable WA on Purchase Order'
+* You can check 'Enforce WA on Goods Receipt' after checked 'Enable WA on Goods Receipt'
+* You can check 'Enforce WA on Vendor Bill' after checked 'Enable WA on Vendor Bill'
+
+Usage
+=====
+
+** Usual process of Purchasing with Work Acceptance **
+
+#. Create a New Purchase Order
+#. Confirm the Purchase Order
+#. Create a new Work Acceptance
+#. Accept the Work Acceptance
+#. Receive the products following a specific Work Acceptance
+#. Create the Vendor Bill following a specific Work Acceptance
+
+** Create a Work Acceptance **
+
+#. Create Purchase Order normally
+#. After 'Confirm Order' (Status = 'Purchase'), Click button 'Create WA'
+#. Accept order
+
+** Control Receipt by Work Acceptance **
+
+#. After 'Confirm Order' in Purchase Order, a smart button 'Receipt' will appear on the Purchase Order
+#. Click 'Receipt' to go to the Transfer
+#. Select the Work Acceptance relating to this picking in the field 'WA Reference'.
+ The quantity done filled automatically for the items that have been already accepted.
+
+** Control Vendor Bill by Work Acceptance **
+
+#. After once the products and/or services have been accepted, Click 'Create Bill'
+#. You will be prompted to select a Work Acceptance. Select it and Click 'Create Vendor Bill'
+
+Bug Tracker
+===========
+
+Bugs are tracked on `GitHub Issues `_.
+In case of trouble, please check there if your issue has already been reported.
+If you spotted it first, help us smashing it by providing a detailed and welcomed
+`feedback `_.
+
+Do not contact contributors directly about support or help with technical issues.
+
+Credits
+=======
+
+Authors
+~~~~~~~
+
+* Ecosoft
+
+Contributors
+~~~~~~~~~~~~
+
+* Pimolnat Suntian
+
+Maintainers
+~~~~~~~~~~~
+
+This module is maintained by the OCA.
+
+.. image:: https://odoo-community.org/logo.png
+ :alt: Odoo Community Association
+ :target: https://odoo-community.org
+
+OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
+
+This module is part of the `OCA/purchase-workflow `_ project on GitHub.
+
+You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/purchase_work_acceptance/__init__.py b/purchase_work_acceptance/__init__.py
new file mode 100644
index 00000000000..4d7a49b5e28
--- /dev/null
+++ b/purchase_work_acceptance/__init__.py
@@ -0,0 +1,4 @@
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from . import models
+from . import wizard
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
new file mode 100644
index 00000000000..1855029b2d0
--- /dev/null
+++ b/purchase_work_acceptance/__manifest__.py
@@ -0,0 +1,31 @@
+# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+{
+ 'name': 'Purchase Work Acceptance',
+ 'version': '12.0.1.0.0',
+ 'category': 'Purchase Management',
+ 'author': 'Ecosoft, '
+ 'Odoo Community Association (OCA)',
+ 'license': 'AGPL-3',
+ 'website': 'https://github.com/OCA/purchase-workflow',
+ 'depends': [
+ 'purchase_stock',
+ ],
+ 'data': [
+ 'data/work_acceptance_sequence.xml',
+ 'security/ir.model.access.csv',
+ 'security/security.xml',
+ 'views/account_invoice_views.xml',
+ 'views/purchase_views.xml',
+ 'views/res_config_settings_views.xml',
+ 'views/stock_picking_views.xml',
+ 'views/work_acceptance_views.xml',
+ 'wizard/select_work_acceptance_wizard_views.xml',
+ ],
+ 'maintainer': [
+ 'ps-tubtim',
+ ],
+ 'installable': True,
+ 'development_status': 'Alpha',
+}
diff --git a/purchase_work_acceptance/data/work_acceptance_sequence.xml b/purchase_work_acceptance/data/work_acceptance_sequence.xml
new file mode 100644
index 00000000000..12cfb883d7b
--- /dev/null
+++ b/purchase_work_acceptance/data/work_acceptance_sequence.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+ Work Acceptance
+ work.acceptance
+ WA
+ 5
+
+
+
+
+
diff --git a/purchase_work_acceptance/models/__init__.py b/purchase_work_acceptance/models/__init__.py
new file mode 100644
index 00000000000..ec77fa9ef3e
--- /dev/null
+++ b/purchase_work_acceptance/models/__init__.py
@@ -0,0 +1,7 @@
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from . import account_invoice
+from . import purchase
+from . import res_config_settings
+from . import stock_picking
+from . import work_acceptance
diff --git a/purchase_work_acceptance/models/account_invoice.py b/purchase_work_acceptance/models/account_invoice.py
new file mode 100644
index 00000000000..52ee9b2fef2
--- /dev/null
+++ b/purchase_work_acceptance/models/account_invoice.py
@@ -0,0 +1,74 @@
+# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from odoo import api, fields, models, _
+from odoo.exceptions import ValidationError
+
+
+class AccountInvoice(models.Model):
+ _inherit = 'account.invoice'
+
+ require_wa = fields.Boolean(
+ compute='_compute_require_wa',
+ )
+ wa_id = fields.Many2one(
+ comodel_name='work.acceptance',
+ string='WA Reference',
+ copy=False,
+ domain=lambda self: [
+ ('state', '=', 'accept'),
+ ('purchase_id', '=', self._context.get('active_id'))],
+ help='To control quantity and unit price of the vendor bill, to be '
+ 'according to the quantity and unit price of the work acceptance.',
+ )
+
+ @api.multi
+ def _compute_require_wa(self):
+ self.require_wa = self.env.user.has_group(
+ 'purchase_work_acceptance.group_enforce_wa_on_invoice')
+
+ def _prepare_invoice_line_from_po_line(self, line):
+ res = super()._prepare_invoice_line_from_po_line(line)
+ wa_line = self.wa_id.wa_line_ids.filtered(
+ lambda l: l.purchase_line_id == line)
+ if wa_line:
+ res['quantity'] = wa_line.product_qty
+ res['uom_id'] = wa_line.product_uom
+ return res
+
+ @api.onchange('purchase_id')
+ def purchase_order_change(self):
+ res = super().purchase_order_change()
+ if self.wa_id:
+ self.reference = self.wa_id.invoice_ref
+ self.currency_id = self.wa_id.currency_id
+ return res
+
+ @api.multi
+ def action_invoice_open(self):
+ for rec in self:
+ if rec.wa_id:
+ wa_line = {}
+ for line in rec.wa_id.wa_line_ids:
+ qty = line.product_uom._compute_quantity(
+ line.product_qty, line.product_id.uom_id)
+ if qty > 0.0:
+ if line.product_id.id in wa_line.keys():
+ qty_old = wa_line[line.product_id.id]
+ wa_line[line.product_id.id] = qty_old + qty
+ else:
+ wa_line[line.product_id.id] = qty
+ invoice_line = {}
+ for line in rec.invoice_line_ids:
+ qty = line.uom_id._compute_quantity(
+ line.quantity, line.product_id.uom_id)
+ if qty > 0.0:
+ if line.product_id.id in invoice_line.keys():
+ qty_old = invoice_line[line.product_id.id]
+ invoice_line[line.product_id.id] = qty_old + qty
+ else:
+ invoice_line[line.product_id.id] = qty
+ if wa_line != invoice_line:
+ raise ValidationError(_('You cannot validate a bill if '
+ 'Quantity not equal accepted quantity'))
+ return super().action_invoice_open()
diff --git a/purchase_work_acceptance/models/purchase.py b/purchase_work_acceptance/models/purchase.py
new file mode 100644
index 00000000000..dd2d6b6ebfb
--- /dev/null
+++ b/purchase_work_acceptance/models/purchase.py
@@ -0,0 +1,96 @@
+# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from odoo import api, fields, models, _
+
+
+class PurchaseOrder(models.Model):
+ _inherit = 'purchase.order'
+
+ wa_count = fields.Integer(
+ compute='_compute_wa_ids',
+ string='WA count',
+ default=0,
+ )
+ wa_ids = fields.One2many(
+ comodel_name='work.acceptance',
+ compute='_compute_wa_ids',
+ string='Work Acceptances',
+ )
+ wa_line_ids = fields.One2many(
+ comodel_name='work.acceptance.line',
+ inverse_name='purchase_line_id',
+ string="WA Lines",
+ readonly=True,
+ )
+
+ def _compute_wa_ids(self):
+ for order in self:
+ order.wa_ids = \
+ order.mapped('order_line').mapped('wa_line_ids').mapped('wa_id')
+ order.wa_count = len(order.wa_ids)
+
+ @api.multi
+ def action_view_wa(self):
+ self.ensure_one()
+ act = self.env.ref('purchase_work_acceptance.action_work_acceptance')
+ result = act.read()[0]
+ create_wa = self.env.context.get('create_wa', False)
+ result['context'] = {
+ 'default_purchase_id': self.id,
+ 'default_partner_id': self.partner_id.id,
+ 'default_company_id': self.company_id.id,
+ 'default_currency_id': self.currency_id.id,
+ 'default_date_due': self.date_planned,
+ 'default_wa_line_ids': [(0, 0, {
+ 'purchase_line_id': line.id,
+ 'name': line.name,
+ 'product_uom': line.product_uom.id,
+ 'product_id': line.product_id.id,
+ 'price_unit': line.price_unit,
+ 'product_qty': line._get_product_qty(),
+ }) for line in self.order_line if line._get_product_qty() != 0],
+ }
+ if len(self.wa_ids) > 1 and not create_wa:
+ result['domain'] = "[('id', 'in', " + str(self.wa_ids.ids) + ")]"
+ else:
+ res = self.env.ref(
+ 'purchase_work_acceptance.view_work_acceptance_form', False)
+ result['views'] = [(res and res.id or False, 'form')]
+ if not create_wa:
+ result['res_id'] = self.wa_ids.id or False
+ return result
+
+ @api.multi
+ def action_view_invoice(self):
+ if self.env.context.get('create_bill', False) and self.env.user.has_group(
+ 'purchase_work_acceptance.group_enable_wa_on_invoice'):
+ wizard = self.env.ref(
+ 'purchase_work_acceptance.view_select_work_acceptance_wizard')
+ return {
+ 'name': _('Select Work Acceptance'),
+ 'type': 'ir.actions.act_window',
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'res_model': 'select.work.acceptance.wizard',
+ 'views': [(wizard.id, 'form')],
+ 'view_id': wizard.id,
+ 'target': 'new',
+ }
+ return super(PurchaseOrder, self).action_view_invoice()
+
+
+class PurchaseOrderLine(models.Model):
+ _inherit = 'purchase.order.line'
+
+ wa_line_ids = fields.One2many(
+ comodel_name='work.acceptance.line',
+ inverse_name='purchase_line_id',
+ string="WA Lines",
+ readonly=True,
+ )
+
+ def _get_product_qty(self):
+ return self.product_qty - sum(
+ wa_line.product_qty for wa_line in self.wa_line_ids
+ if wa_line.wa_id.state != 'cancel')
diff --git a/purchase_work_acceptance/models/res_config_settings.py b/purchase_work_acceptance/models/res_config_settings.py
new file mode 100644
index 00000000000..e8814a1f213
--- /dev/null
+++ b/purchase_work_acceptance/models/res_config_settings.py
@@ -0,0 +1,29 @@
+# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from odoo import fields, models
+
+
+class ResConfigSettings(models.TransientModel):
+ _inherit = 'res.config.settings'
+
+ group_enable_wa_on_po = fields.Boolean(
+ string="Enable WA on Purchase Order",
+ implied_group='purchase_work_acceptance.group_enable_wa_on_po',
+ )
+ group_enable_wa_on_in = fields.Boolean(
+ string="Enable WA on Goods Receipt",
+ implied_group='purchase_work_acceptance.group_enable_wa_on_in',
+ )
+ group_enforce_wa_on_in = fields.Boolean(
+ string="Enforce WA on Goods Receipt",
+ implied_group='purchase_work_acceptance.group_enforce_wa_on_in',
+ )
+ group_enable_wa_on_invoice = fields.Boolean(
+ string="Enable WA on Vendor Bill",
+ implied_group='purchase_work_acceptance.group_enable_wa_on_invoice',
+ )
+ group_enforce_wa_on_invoice = fields.Boolean(
+ string="Enforce WA on Vendor Bill",
+ implied_group='purchase_work_acceptance.group_enforce_wa_on_invoice',
+ )
diff --git a/purchase_work_acceptance/models/stock_picking.py b/purchase_work_acceptance/models/stock_picking.py
new file mode 100644
index 00000000000..f729f9c06f3
--- /dev/null
+++ b/purchase_work_acceptance/models/stock_picking.py
@@ -0,0 +1,80 @@
+# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from odoo import api, fields, models, _
+from odoo.exceptions import ValidationError
+
+
+class Picking(models.Model):
+ _inherit = "stock.picking"
+
+ require_wa = fields.Boolean(
+ compute='_compute_require_wa',
+ )
+ wa_id = fields.Many2one(
+ comodel_name='work.acceptance',
+ string='WA Reference',
+ copy=False,
+ domain=lambda self: [
+ ('state', '=', 'accept'),
+ ('purchase_id', '=', self._context.get('active_id'))],
+ )
+
+ @api.multi
+ def _compute_require_wa(self):
+ self.require_wa = self.env.user.has_group(
+ 'purchase_work_acceptance.group_enforce_wa_on_in')
+
+ @api.multi
+ def button_validate(self):
+ if self.wa_id:
+ order = self.env['purchase.order'].browse(self._context.get('active_id'))
+ if any(picking.wa_id == self.wa_id and picking != self
+ for picking in order.picking_ids):
+ raise ValidationError(_(
+ '%s was used in some picking.') % self.wa_id.name)
+ wa_line = {}
+ for line in self.wa_id.wa_line_ids:
+ qty = line.product_uom._compute_quantity(
+ line.product_qty, line.product_id.uom_id)
+ if qty > 0.0 and line.product_id.type in ['product', 'consu']:
+ if line.product_id.id in wa_line.keys():
+ qty_old = wa_line[line.product_id.id]
+ wa_line[line.product_id.id] = qty_old + qty
+ else:
+ wa_line[line.product_id.id] = qty
+ move_line = {}
+ for move in self.move_ids_without_package:
+ qty = move.product_uom._compute_quantity(
+ move.quantity_done, line.product_id.uom_id)
+ if qty > 0.0:
+ if move.product_id.id in move_line.keys():
+ qty_old = move_line[move.product_id.id]
+ move_line[move.product_id.id] = qty_old + qty
+ else:
+ move_line[move.product_id.id] = qty
+ if wa_line != move_line:
+ raise ValidationError(_('You cannot validate a transfer if done'
+ ' quantity not equal accepted quantity'))
+ return super(Picking, self).button_validate()
+
+ @api.onchange('wa_id')
+ def _onchange_wa_id(self):
+ if self.wa_id:
+ wa_line = {}
+ for line in self.wa_id.wa_line_ids:
+ qty = line.product_uom._compute_quantity(
+ line.product_qty, line.product_id.uom_id)
+ if line.product_id.id in wa_line.keys():
+ qty_old = wa_line[line.product_id.id]
+ wa_line[line.product_id.id] = qty_old + qty
+ else:
+ wa_line[line.product_id.id] = qty
+ for move_line in self.move_line_ids_without_package:
+ if move_line.product_id.id in wa_line.keys():
+ qty = wa_line[move_line.product_id.id]
+ if move_line.product_uom_qty < qty:
+ move_line.qty_done = move_line.product_uom_qty
+ wa_line[line.product_id.id] = qty - move_line.product_uom_qty
+ else:
+ move_line.qty_done = qty
diff --git a/purchase_work_acceptance/models/work_acceptance.py b/purchase_work_acceptance/models/work_acceptance.py
new file mode 100644
index 00000000000..433f3b9b34c
--- /dev/null
+++ b/purchase_work_acceptance/models/work_acceptance.py
@@ -0,0 +1,224 @@
+# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from odoo import api, fields, models
+
+
+class WorkAcceptance(models.Model):
+ _name = 'work.acceptance'
+ _inherit = ['mail.thread', 'mail.activity.mixin', 'portal.mixin']
+ _description = 'Work Acceptance'
+ _order = 'id desc'
+
+ name = fields.Char(
+ required=True,
+ index=True,
+ copy=False,
+ default='New'
+ )
+ date_due = fields.Datetime(
+ string='Due Date',
+ required=True,
+ readonly=True,
+ states={'draft': [('readonly', False)]},
+ )
+ date_receive = fields.Datetime(
+ string='Received Date',
+ default=fields.Datetime.now,
+ required=True,
+ readonly=True,
+ states={'draft': [('readonly', False)]},
+ )
+ date_accept = fields.Datetime(
+ string='Accepted Date',
+ readonly=True,
+ )
+ invoice_ref = fields.Char(
+ string='Invoice Reference',
+ copy=False,
+ )
+ partner_id = fields.Many2one(
+ comodel_name='res.partner',
+ string='Vendor',
+ required=True,
+ change_default=True,
+ track_visibility='always',
+ readonly=True,
+ states={'draft': [('readonly', False)]},
+ )
+ responsible_id = fields.Many2one(
+ comodel_name='res.users',
+ string='Responsible Person',
+ default=lambda self: self.env.user,
+ required=True,
+ change_default=True,
+ track_visibility='always',
+ readonly=True,
+ states={'draft': [('readonly', False)]},
+ )
+ currency_id = fields.Many2one(
+ comodel_name='res.currency',
+ string='Currency',
+ default=lambda self: self.env.user.company_id.currency_id.id,
+ required=True,
+ readonly=True,
+ )
+ state = fields.Selection(
+ [('draft', 'Draft'),
+ ('accept', 'Accepted'),
+ ('cancel', 'Cancelled')],
+ string='Status',
+ readonly=True,
+ index=True,
+ copy=False,
+ default='draft',
+ track_visibility='onchange'
+ )
+ wa_line_ids = fields.One2many(
+ comodel_name='work.acceptance.line',
+ inverse_name='wa_id',
+ string='Work Acceptance Lines',
+ )
+ notes = fields.Text(
+ string='Notes',
+ )
+ product_id = fields.Many2one(
+ comodel_name='product.product',
+ related='wa_line_ids.product_id',
+ string='Product',
+ readonly=False,
+ )
+ user_id = fields.Many2one(
+ comodel_name='res.users',
+ string='Work Acceptance Representative',
+ default=lambda self: self.env.user,
+ index=True,
+ track_visibility='onchange',
+ )
+ company_id = fields.Many2one(
+ comodel_name='res.company',
+ string='Company',
+ default=lambda self: self.env.user.company_id.id,
+ required=True,
+ index=True,
+ readonly=True,
+ states={'draft': [('readonly', False)]},
+ )
+ purchase_id = fields.Many2one(
+ comodel_name='purchase.order',
+ string='Purchase Order',
+ readonly=True,
+ )
+
+ @api.model
+ def create(self, vals):
+ if vals.get('name', 'New') == 'New':
+ vals['name'] = self.env['ir.sequence'].next_by_code(
+ 'work.acceptance') or '/'
+ return super(WorkAcceptance, self).create(vals)
+
+ @api.multi
+ def button_accept(self, force=False):
+ self._unlink_zero_quantity()
+ po_lines = self.purchase_id.order_line
+ for po_line in po_lines:
+ if po_line.product_id.type not in ['product', 'consu']:
+ po_line.qty_received = self.wa_line_ids.filtered(
+ lambda l: l.purchase_line_id == po_line).product_qty
+ self.write({'state': 'accept', 'date_accept': fields.Datetime.now()})
+
+ @api.multi
+ def button_draft(self):
+ self.write({'state': 'draft'})
+
+ @api.multi
+ def button_cancel(self):
+ self.write({'state': 'cancel'})
+
+ def _unlink_zero_quantity(self):
+ wa_line_zero_quantity = self.wa_line_ids.filtered(
+ lambda l: l.product_qty == 0.0)
+ wa_line_zero_quantity.unlink()
+
+
+class WorkAcceptanceLine(models.Model):
+ _name = 'work.acceptance.line'
+ _description = 'Work Acceptance Line'
+ _order = 'id'
+
+ name = fields.Text(
+ string='Description',
+ required=True
+ )
+ product_qty = fields.Float(
+ string='Quantity',
+ required=True,
+ )
+ product_id = fields.Many2one(
+ comodel_name='product.product',
+ string='Product',
+ required=True,
+ )
+ product_uom = fields.Many2one(
+ comodel_name='uom.uom',
+ string='Product Unit of Measure',
+ required=True,
+ )
+ price_unit = fields.Float(
+ string='Unit Price',
+ required=True,
+ )
+ price_subtotal = fields.Monetary(
+ compute='_compute_amount',
+ string='Subtotal',
+ )
+ wa_id = fields.Many2one(
+ comodel_name='work.acceptance',
+ string='WA Reference',
+ index=True,
+ required=True,
+ ondelete='cascade'
+ )
+ partner_id = fields.Many2one(
+ comodel_name='res.partner',
+ related='wa_id.partner_id',
+ string='Partner',
+ readonly=True,
+ )
+ responsible_id = fields.Many2one(
+ comodel_name='res.users',
+ related='wa_id.responsible_id',
+ string='Responsible Person',
+ readonly=True,
+ )
+ currency_id = fields.Many2one(
+ related='wa_id.currency_id',
+ string='Currency',
+ readonly=True,
+ )
+ date_due = fields.Datetime(
+ related='wa_id.date_due',
+ string='Due Date',
+ readonly=True,
+ )
+ date_receive = fields.Datetime(
+ related='wa_id.date_receive',
+ string='Received Date',
+ readonly=True,
+ )
+ date_accept = fields.Datetime(
+ related='wa_id.date_accept',
+ string='Accepted Date',
+ readonly=True,
+ )
+ purchase_line_id = fields.Many2one(
+ comodel_name='purchase.order.line',
+ string='Purchase Order Line',
+ ondelete='set null',
+ index=True,
+ readonly=True,
+ )
+
+ def _compute_amount(self):
+ for line in self:
+ line.price_subtotal = line.product_qty * line.price_unit
diff --git a/purchase_work_acceptance/readme/CONFIGURE.rst b/purchase_work_acceptance/readme/CONFIGURE.rst
new file mode 100644
index 00000000000..7a071edf319
--- /dev/null
+++ b/purchase_work_acceptance/readme/CONFIGURE.rst
@@ -0,0 +1,30 @@
+** Show Button Create WA on Purchase Order **
+
+#. Go to *Purchase > Configuration > Settings*
+#. Check 'Enable WA on Purchase Order'
+
+** Show WA Reference fields on Receipt **
+
+#. Go to *Purchase > Configuration > Settings*
+#. Check 'Enable WA on Goods Receipt'
+
+** Control Receipt by Work Acceptance**
+
+#. Go to *Purchase > Configuration > Settings*
+#. Check 'Enforce WA on Goods Receipt'
+
+** Show WA Reference fields on Vendor Bill **
+
+#. Go to *Purchase > Configuration > Settings*
+#. Check 'Enable WA on Vendor Bill'
+
+** Control Vendor Bill by Work Acceptance**
+
+#. Go to *Purchase > Configuration > Settings*
+#. Check 'Enforce WA on Vendor Bill'
+
+Note:
+
+* You can check 'Enable WA on Goods Receipt' and 'Enable WA on Vendor Bill' after checked 'Enable WA on Purchase Order'
+* You can check 'Enforce WA on Goods Receipt' after checked 'Enable WA on Goods Receipt'
+* You can check 'Enforce WA on Vendor Bill' after checked 'Enable WA on Vendor Bill'
diff --git a/purchase_work_acceptance/readme/CONTRIBUTORS.rst b/purchase_work_acceptance/readme/CONTRIBUTORS.rst
new file mode 100644
index 00000000000..0ef1f84c3fd
--- /dev/null
+++ b/purchase_work_acceptance/readme/CONTRIBUTORS.rst
@@ -0,0 +1 @@
+* Pimolnat Suntian
diff --git a/purchase_work_acceptance/readme/DESCRIPTION.rst b/purchase_work_acceptance/readme/DESCRIPTION.rst
new file mode 100644
index 00000000000..b9a818b39d0
--- /dev/null
+++ b/purchase_work_acceptance/readme/DESCRIPTION.rst
@@ -0,0 +1,3 @@
+This module introduces the ability to define a quantity control point on Receipts and Vendor Bills by
+Work Acceptance. Only the products and services that have been included in a Work Acceptance can be
+received and/or invoiced.
diff --git a/purchase_work_acceptance/readme/USAGE.rst b/purchase_work_acceptance/readme/USAGE.rst
new file mode 100644
index 00000000000..a9b4a125112
--- /dev/null
+++ b/purchase_work_acceptance/readme/USAGE.rst
@@ -0,0 +1,26 @@
+** Usual process of Purchasing with Work Acceptance **
+
+#. Create a New Purchase Order
+#. Confirm the Purchase Order
+#. Create a new Work Acceptance
+#. Accept the Work Acceptance
+#. Receive the products following a specific Work Acceptance
+#. Create the Vendor Bill following a specific Work Acceptance
+
+** Create a Work Acceptance **
+
+#. Create Purchase Order normally
+#. After 'Confirm Order' (Status = 'Purchase'), Click button 'Create WA'
+#. Accept order
+
+** Control Receipt by Work Acceptance **
+
+#. After 'Confirm Order' in Purchase Order, a smart button 'Receipt' will appear on the Purchase Order
+#. Click 'Receipt' to go to the Transfer
+#. Select the Work Acceptance relating to this picking in the field 'WA Reference'.
+ The quantity done filled automatically for the items that have been already accepted.
+
+** Control Vendor Bill by Work Acceptance **
+
+#. After once the products and/or services have been accepted, Click 'Create Bill'
+#. You will be prompted to select a Work Acceptance. Select it and Click 'Create Vendor Bill'
diff --git a/purchase_work_acceptance/security/ir.model.access.csv b/purchase_work_acceptance/security/ir.model.access.csv
new file mode 100644
index 00000000000..8a600c6e5a5
--- /dev/null
+++ b/purchase_work_acceptance/security/ir.model.access.csv
@@ -0,0 +1,3 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_work_acceptance,access_work_acceptance,model_work_acceptance,purchase.group_purchase_user,1,1,1,1
+access_work_acceptance_line,access_work_acceptance_line,model_work_acceptance_line,purchase.group_purchase_user,1,1,1,1
diff --git a/purchase_work_acceptance/security/security.xml b/purchase_work_acceptance/security/security.xml
new file mode 100644
index 00000000000..2c0f7f4257b
--- /dev/null
+++ b/purchase_work_acceptance/security/security.xml
@@ -0,0 +1,29 @@
+
+
+
+
+ Enable WA on Purchase Order
+
+
+
+
+ Enable WA on Goods Receipt
+
+
+
+
+ Enforce WA on Goods Receipt
+
+
+
+
+ Enable WA on Vendor Bill
+
+
+
+
+ Enforce WA on Vendor Bill
+
+
+
+
diff --git a/purchase_work_acceptance/static/description/icon.png b/purchase_work_acceptance/static/description/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d
GIT binary patch
literal 9455
zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~!
zVpnB`o+K7|Al`Q_U;eD$B
zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA
z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__
zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_
zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I
z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U
z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)(
z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH
zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW
z*bMSSOauW>o;*=kO8ojw91VX!qoOQb)zHJ!odWB}d+*K?#sY_jqPdg{Sm2HdYzdEx
zOGVPhVRTGPtv0o}RfVP;Nd(|CB)I;*t&QO8h
zFfekr30S!-LHmV_Su-W+rEwYXJ^;6&3|L$mMC8*bQptyOo9;>Qb9Q9`ySe3%V$A*9
zeKEe+b0{#KWGp$F+tga)0RtI)nhMa-K@JS}2krK~n8vJ=Ngm?R!9G<~RyuU0d?nz#
z-5EK$o(!F?hmX*2Yt6+coY`6jGbb7tF#6nHA
zuKk=GGJ;ZwON1iAfG$E#Y7MnZVmrY|j0eVI(DN_MNFJmyZ|;w4tf@=CCDZ#5N_0K=
z$;R~bbk?}TpfDjfB&aiQ$VA}s?P}xPERJG{kxk5~R`iRS(SK5d+Xs9swCozZISbnS
zk!)I0>t=A<-^z(cmSFz3=jZ23u13X><0b)P)^1T_))Kr`e!-pb#q&J*Q`p+B6la%C
zuVl&0duN<;uOsB3%T9Fp8t{ED108)`y_~Hnd9AUX7h-H?jVuU|}My+C=TjH(jKz
zqMVr0re3S$H@t{zI95qa)+Crz*5Zj}Ao%4Z><+W(nOZd?gDnfNBC3>M8WE61$So|P
zVvqH0SNtDTcsUdzaMDpT=Ty0pDHHNL@Z0w$Y`XO
z2M-_r1S+GaH%pz#Uy0*w$Vdl=X=rQXEzO}d6J^R6zjM1u&c9vYLvLp?W7w(?np9x1
zE_0JSAJCPB%i7p*Wvg)pn5T`8k3-uR?*NT|J`eS#_#54p>!p(mLDvmc-3o0mX*mp_
zN*AeS<>#^-{S%W<*mz^!X$w_2dHWpcJ6^j64qFBft-o}o_Vx80o0>}Du;>kLts;$8
zC`7q$QI(dKYG`Wa8#wl@V4jVWBRGQ@1dr-hstpQL)Tl+aqVpGpbSfN>5i&QMXfiZ>
zaA?T1VGe?rpQ@;+pkrVdd{klI&jVS@I5_iz!=UMpTsa~mBga?1r}aRBm1WS;TT*s0f0lY=JBl66Upy)-k4J}lh=P^8(SXk~0xW=T9v*B|gzIhN
z>qsO7dFd~mgxAy4V?&)=5ieYq?zi?ZEoj)&2o)RLy=@hbCRcfT5jigwtQGE{L*8<@Yd{zg;CsL5mvzfDY}P-wos_6PfprFVaeqNE%h
zKZhLtcQld;ZD+>=nqN~>GvROfueSzJD&BE*}XfU|H&(FssBqY=hPCt`d
zH?@s2>I(|;fcW&YM6#V#!kUIP8$Nkdh0A(bEVj``-AAyYgwY~jB
zT|I7Bf@%;7aL7Wf4dZ%VqF$eiaC38OV6oy3Z#TER2G+fOCd9Iaoy6aLYbPTN{XRPz
z;U!V|vBf%H!}52L2gH_+j;`bTcQRXB+y9onc^wLm5wi3-Be}U>k_u>2Eg$=k!(l@I
zcCg+flakT2Nej3i0yn+g+}%NYb?ta;R?(g5SnwsQ49U8Wng8d|{B+lyRcEDvR3+`O{zfmrmvFrL6acVP%yG98X
zo&+VBg@px@i)%o?dG(`T;n*$S5*rnyiR#=wW}}GsAcfyQpE|>a{=$Hjg=-*_K;UtD
z#z-)AXwSRY?OPefw^iI+
z)AXz#PfEjlwTes|_{sB?4(O@fg0AJ^g8gP}ex9Ucf*@_^J(s_5jJV}c)s$`Myn|Kd
z$6>}#q^n{4vN@+Os$m7KV+`}c%4)4pv@06af4-x5#wj!KKb%caK{A&Y#Rfs
z-po?Dcb1({W=6FKIUirH&(yg=*6aLCekcKwyfK^JN5{wcA3nhO(o}SK#!CINhI`-I
z1)6&n7O&ZmyFMuNwvEic#IiOAwNkR=u5it{B9n2sAJV5pNhar=j5`*N!Na;c7g!l$
z3aYBqUkqqTJ=Re-;)s!EOeij=7SQZ3Hq}ZRds%IM*PtM$wV
z@;rlc*NRK7i3y5BETSKuumEN`Xu_8GP1Ri=OKQ$@I^ko8>H6)4rjiG5{VBM>B|%`&&s^)jS|-_95&yc=GqjNo{zFkw%%HHhS~e=s
zD#sfS+-?*t|J!+ozP6KvtOl!R)@@-z24}`9{QaVLD^9VCSR2b`b!KC#o;Ki<+wXB6
zx3&O0LOWcg4&rv4QG0)4yb}7BFSEg~=IR5#ZRj8kg}dS7_V&^%#Do==#`u
zpy6{ox?jWuR(;pg+f@mT>#HGWHAJRRDDDv~@(IDw&R>9643kK#HN`!1vBJHnC+RM&yIh8{gG2q
zA%e*U3|N0XSRa~oX-3EAneep)@{h2vvd3Xvy$7og(sayr@95+e6~Xvi1tUqnIxoIH
zVWo*OwYElb#uyW{Imam6f2rGbjR!Y3`#gPqkv57dB6K^wRGxc9B(t|aYDGS=m$&S!NmCtrMMaUg(c
zc2qC=2Z`EEFMW-me5B)24AqF*bV5Dr-M5ig(l-WPS%CgaPzs6p_gnCIvTJ=Y<6!gT
zVt@AfYCzjjsMEGi=rDQHo0yc;HqoRNnNFeWZgcm?f;cp(6CNylj36DoL(?TS7eU#+
z7&mfr#y))+CJOXQKUMZ7QIdS9@#-}7y2K1{8)cCt0~-X0O!O?Qx#E4Og+;A2SjalQ
zs7r?qn0H044=sDN$SRG$arw~n=+T_DNdSrarmu)V6@|?1-ZB#hRn`uilTGPJ@fqEy
zGt(f0B+^JDP&f=r{#Y_wi#AVDf-y!RIXU^0jXsFpf>=Ji*TeqSY!H~AMbJdCGLhC)
zn7Rx+sXw6uYj;WRYrLd^5IZq@6JI1C^YkgnedZEYy<&4(z%Q$5yv#Boo{AH8n$a
zhb4Y3PWdr269&?V%uI$xMcUrMzl=;w<_nm*qr=c3Rl@i5wWB;e-`t7D&c-mcQl7x!
zZWB`UGcw=Y2=}~wzrfLx=uet<;m3~=8I~ZRuzvMQUQdr+yTV|ATf1Uuomr__nDf=X
zZ3WYJtHp_ri(}SQAPjv+Y+0=fH4krOP@S&=zZ-t1jW1o@}z;xk8
z(Nz1co&El^HK^NrhVHa-_;&88vTU>_J33=%{if;BEY*J#1n59=07jrGQ#IP>@u#3A
z;!q+E1Rj3ZJ+!4bq9F8PXJ@yMgZL;>&gYA0%_Kbi8?S=XGM~dnQZQ!yBSgcZhY96H
zrWnU;k)qy`rX&&xlDyA%(a1Hhi5CWkmg(`Gb%m(HKi-7Z!LKGRP_B8@`7&hdDy5n=
z`OIxqxiVfX@OX1p(mQu>0Ai*v_cTMiw4qRt3~NBvr9oBy0)r>w3p~V0SCm=An6@3n)>@z!|o-$HvDK
z|3D2ZMJkLE5loMKl6R^ez@Zz%S$&mbeoqH5`Bb){Ei21q&VP)hWS2tjShfFtGE+$z
zzCR$P#uktu+#!w)cX!lWN1XU%K-r=s{|j?)Akf@q#3b#{6cZCuJ~gCxuMXRmI$nGtnH+-h
z+GEi!*X=AP<|fG`1>MBdTb?28JYc=fGvAi2I<$B(rs$;eoJCyR6_bc~p!XR@O-+sD
z=eH`-ye})I5ic1eL~TDmtfJ|8`0VJ*Yr=hNCd)G1p2MMz4C3^Mj?7;!w|Ly%JqmuW
zlIEW^Ft%z?*|fpXda>Jr^1noFZEwFgVV%|*XhH@acv8rdGxeEX{M$(vG{Zw+x(ei@
zmfXb22}8-?Fi`vo-YVrTH*C?a8%M=Hv9MqVH7H^J$KsD?>!SFZ;ZsvnHr_gn=7acz
z#W?0eCdVhVMWN12VV^$>WlQ?f;P^{(&pYTops|btm6aj>_Uz+hqpGwB)vWp0Cf5y<
zft8-je~nn?W11plq}N)4A{l8I7$!ks_x$PXW-2XaRFswX_BnF{R#6YIwMhAgd5F9X
zGmwdadS6(a^fjHtXg8=l?Rc0Sm%hk6E9!5cLVloEy4eh(=FwgP`)~I^5~pBEWo+F6
zSf2ncyMurJN91#cJTy_u8Y}@%!bq1RkGC~-bV@SXRd4F{R-*V`bS+6;W5vZ(&+I<9$;-V|eNfLa5n-6%
z2(}&uGRF;p92eS*sE*oR$@pexaqr*meB)VhmIg@h{uzkk$9~qh#cHhw#>O%)b@+(|
z^IQgqzuj~Sk(J;swEM-3TrJAPCq9k^^^`q{IItKBRXYe}e0Tdr=Huf7da3$l4PdpwWDop%^}n;dD#K4s#DYA8SHZ
z&1!riV4W4R7R#C))JH1~axJ)RYnM$$lIR%6fIVA@zV{XVyx}C+a-Dt8Y9M)^KU0+H
zR4IUb2CJ{Hg>CuaXtD50jB(_Tcx=Z$^WYu2u5kubqmwp%drJ6
z?Fo40g!Qd<-l=TQxqHEOuPX0;^z7iX?Ke^a%XT<13TA^5`4Xcw6D@Ur&VT&CUe0d}
z1GjOVF1^L@>O)l@?bD~$wzgf(nxX1OGD8fEV?TdJcZc2KoUe|oP1#=$$7ee|xbY)A
zDZq+cuTpc(fFdj^=!;{k03C69lMQ(|>uhRfRu%+!k&YOi-3|1QKB
z
z?n?eq1XP>p-IM$Z^C;2L3itnbJZAip*Zo0aw2bs8@(s^~*8T9go!%dHcAz2lM;`yp
zD=7&xjFV$S&5uDaiScyD?B-i1ze`+CoRtz`Wn+Zls4&}MO{@N!ufrzjG$B79)Y2d3tBk&)TxUTw@QS0TEL_?njX|@vq?Uz(nBFK5Pq7*xj#u*R&i|?7+6#
z+|r_n#SW&LXhtheZdah{ZVoqwyT{D>MC3nkFF#N)xLi{p7J1jXlmVeb;cP5?e(=f#
zuT7fvjSbjS781v?7{)-X3*?>tq?)Yd)~|1{BDS(pqC
zC}~H#WXlkUW*H5CDOo<)#x7%RY)A;ShGhI5s*#cRDA8YgqG(HeKDx+#(ZQ?386dv!
zlXCO)w91~Vw4AmOcATuV653fa9R$fyK8ul%rG
z-wfS
zihugoZyr38Im?Zuh6@RcF~t1anQu7>#lPpb#}4cOA!EM11`%f*07RqOVkmX{p~KJ9
z^zP;K#|)$`^Rb{rnHGH{~>1(fawV0*Z#)}M`m8-?ZJV<+e}s9wE#
z)l&az?w^5{)`S(%MRzxdNqrs1n*-=jS^_jqE*5XDrA0+VE`5^*p3CuM<&dZEeCjoz
zR;uu_H9ZPZV|fQq`Cyw4nscrVwi!fE6ciMmX$!_hN7uF;jjKG)d2@aC4ropY)8etW=xJvni)8eHi`H$%#zn^WJ5NLc-rqk|u&&4Z6fD_m&JfSI1Bvb?b<*n&sfl0^t
z=HnmRl`XrFvMKB%9}>PaA`m-fK6a0(8=qPkWS5bb4=v?XcWi&hRY?O5HdulRi4?fN
zlsJ*N-0Qw+Yic@s0(2uy%F@ib;GjXt01Fmx5XbRo6+n|pP(&nodMoap^z{~q
ziEeaUT@Mxe3vJSfI6?uLND(CNr=#^W<1b}jzW58bIfyWTDle$mmS(|x-0|2UlX+9k
zQ^EX7Nw}?EzVoBfT(-LT|=9N@^hcn-_p&sqG
z&*oVs2JSU+N4ZD`FhCAWaS;>|wH2G*Id|?pa#@>tyxX`+4HyIArWDvVrX)2WAOQff
z0qyHu&-S@i^MS-+j--!pr4fPBj~_8({~e1bfcl0wI1kaoN>mJL6KUPQm5N7lB(ui1
zE-o%kq)&djzWJ}ob<-GfDlkB;F31j-VHKvQUGQ3sp`CwyGJk_i!y^sD0fqC@$9|jO
zOqN!r!8-p==F@ZVP=U$qSpY(gQ0)59P1&t@y?5rvg<}E+GB}26NYPp4f2YFQrQtot5mn3wu_qprZ=>Ig-$
zbW26Ws~IgY>}^5w`vTB(G`PTZaDiGBo5o(tp)qli|NeV(
z@H_=R8V39rt5J5YB2Ky?4eJJ#b`_iBe2ot~6%7mLt5t8Vwi^Jy7|jWXqa3amOIoRb
zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4
z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{
zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx}
z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov
zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22
zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq
zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t<
z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k
z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp
z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{}
zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N
Xviia!U7SGha1wx#SCgwmn*{w2TRX*I
literal 0
HcmV?d00001
diff --git a/purchase_work_acceptance/static/description/index.html b/purchase_work_acceptance/static/description/index.html
new file mode 100644
index 00000000000..9bf6c1f05e4
--- /dev/null
+++ b/purchase_work_acceptance/static/description/index.html
@@ -0,0 +1,493 @@
+
+
+
+
+
+
+Purchase Work Acceptance
+
+
+
+
+
Purchase Work Acceptance
+
+
+
+
This module introduces the ability to define a quantity control point on Receipts and Vendor Bills by
+Work Acceptance. Only the products and services that have been included in a Work Acceptance can be
+received and/or invoiced.
+
+
Important
+
This is an alpha version, the data model and design can change at any time without warning.
+Only for development or testing purpose, do not use in production.
+More details on development status
+
+
Table of contents
+
+
+
+
** Show Button Create WA on Purchase Order **
+
+Go to Purchase > Configuration > Settings
+Check ‘Enable WA on Purchase Order’
+
+
** Show WA Reference fields on Receipt **
+
+Go to Purchase > Configuration > Settings
+Check ‘Enable WA on Goods Receipt’
+
+
** Control Receipt by Work Acceptance**
+
+Go to Purchase > Configuration > Settings
+Check ‘Enforce WA on Goods Receipt’
+
+
** Show WA Reference fields on Vendor Bill **
+
+Go to Purchase > Configuration > Settings
+Check ‘Enable WA on Vendor Bill’
+
+
** Control Vendor Bill by Work Acceptance**
+
+Go to Purchase > Configuration > Settings
+Check ‘Enforce WA on Vendor Bill’
+
+
Note:
+
+You can check ‘Enable WA on Goods Receipt’ and ‘Enable WA on Vendor Bill’ after checked ‘Enable WA on Purchase Order’
+You can check ‘Enforce WA on Goods Receipt’ after checked ‘Enable WA on Goods Receipt’
+You can check ‘Enforce WA on Vendor Bill’ after checked ‘Enable WA on Vendor Bill’
+
+
+
+
+
** Usual process of Purchasing with Work Acceptance **
+
+Create a New Purchase Order
+Confirm the Purchase Order
+Create a new Work Acceptance
+Accept the Work Acceptance
+Receive the products following a specific Work Acceptance
+Create the Vendor Bill following a specific Work Acceptance
+
+
** Create a Work Acceptance **
+
+Create Purchase Order normally
+After ‘Confirm Order’ (Status = ‘Purchase’), Click button ‘Create WA’
+Accept order
+
+
** Control Receipt by Work Acceptance **
+
+After ‘Confirm Order’ in Purchase Order, a smart button ‘Receipt’ will appear on the Purchase Order
+Click ‘Receipt’ to go to the Transfer
+Select the Work Acceptance relating to this picking in the field ‘WA Reference’.
+The quantity done filled automatically for the items that have been already accepted.
+
+
** Control Vendor Bill by Work Acceptance **
+
+After once the products and/or services have been accepted, Click ‘Create Bill’
+You will be prompted to select a Work Acceptance. Select it and Click ‘Create Vendor Bill’
+
+
+
+
+
Bugs are tracked on GitHub Issues .
+In case of trouble, please check there if your issue has already been reported.
+If you spotted it first, help us smashing it by providing a detailed and welcomed
+feedback .
+
Do not contact contributors directly about support or help with technical issues.
+
+
+
+
+
+
+
+
This module is maintained by the OCA.
+
+
OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
+
This module is part of the OCA/purchase-workflow project on GitHub.
+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute .
+
+
+
+
+
diff --git a/purchase_work_acceptance/tests/__init__.py b/purchase_work_acceptance/tests/__init__.py
new file mode 100644
index 00000000000..de27bbbe5f6
--- /dev/null
+++ b/purchase_work_acceptance/tests/__init__.py
@@ -0,0 +1,3 @@
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from . import test_purchase_work_acceptance
diff --git a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
new file mode 100644
index 00000000000..992452658d5
--- /dev/null
+++ b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
@@ -0,0 +1,171 @@
+# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from odoo import fields
+from odoo.exceptions import ValidationError
+from odoo.tests.common import TransactionCase, Form
+
+
+class TestPurchaseWorkAcceptance(TransactionCase):
+ def setUp(self):
+ super(TestPurchaseWorkAcceptance, self).setUp()
+ # Create Product
+ self.service_product = self.env.ref('product.product_product_1')
+ self.product_product = self.env.ref('product.product_product_6')
+ # Create Vendor
+ self.res_partner = self.env.ref('base.res_partner_3')
+ # Create Employee
+ self.employee = self.env.ref('base.user_demo')
+ # Create Date
+ self.date_now = fields.Datetime.now()
+
+ def test_00_wa_button(self):
+ work_acceptance = self.env['work.acceptance'].create({
+ 'partner_id': self.res_partner.id,
+ 'responsible_id': self.employee.id,
+ 'date_due': self.date_now,
+ 'date_receive': self.date_now,
+ 'company_id': self.env.ref('base.main_company').id,
+ 'wa_line_ids': [
+ (0, 0, {'product_id': self.service_product.id,
+ 'name': self.service_product.name,
+ 'price_unit': self.service_product.standard_price,
+ 'product_qty': 3.0,
+ 'product_uom': self.service_product.uom_id.id,
+ })]
+ })
+ work_acceptance.button_accept()
+ self.assertEqual(work_acceptance.state, 'accept')
+ work_acceptance.button_cancel()
+ self.assertEqual(work_acceptance.state, 'cancel')
+ work_acceptance.button_draft()
+ self.assertEqual(work_acceptance.state, 'draft')
+
+ def test_01_action_view_wa(self):
+ # Create Purchase Order
+ purchase_order = self.env['purchase.order'].create({
+ 'partner_id': self.res_partner.id,
+ 'order_line': [
+ (0, 0, {'product_id': self.service_product.id,
+ 'product_uom': self.service_product.uom_id.id,
+ 'name': self.service_product.name,
+ 'price_unit': self.service_product.standard_price,
+ 'date_planned': self.date_now,
+ 'product_qty': 42.0})]})
+ purchase_order.button_confirm()
+ self.assertEqual(purchase_order.state, 'purchase')
+
+ res = purchase_order.with_context(create_wa=True).action_view_wa()
+ ctx = res.get('context')
+ work_acceptance = Form(self.env['work.acceptance'].with_context(ctx))
+ self.assertEqual(work_acceptance.state, 'draft')
+
+ def test_02_flow_product(self):
+ # Create Purchase Order
+ purchase_order = self.env['purchase.order'].create({
+ 'partner_id': self.res_partner.id,
+ 'order_line': [
+ (0, 0, {'product_id': self.product_product.id,
+ 'product_uom': self.product_product.uom_id.id,
+ 'name': self.product_product.name,
+ 'price_unit': self.product_product.standard_price,
+ 'date_planned': self.date_now,
+ 'product_qty': 42.0})]
+ })
+ purchase_order.button_confirm()
+ self.assertEqual(purchase_order.state, 'purchase')
+ self.assertEqual(purchase_order.picking_count, 1)
+ # Create Work Acceptance
+ work_acceptance = self.env['work.acceptance'].create({
+ 'purchase_id': purchase_order.id,
+ 'partner_id': self.res_partner.id,
+ 'responsible_id': self.employee.id,
+ 'date_due': self.date_now,
+ 'date_receive': self.date_now,
+ 'company_id': self.env.ref('base.main_company').id,
+ 'wa_line_ids': [
+ (0, 0, {'purchase_line_id': purchase_order.order_line[0].id,
+ 'product_id': purchase_order.order_line[0].product_id.id,
+ 'name': purchase_order.order_line[0].name,
+ 'price_unit': purchase_order.order_line[0].price_unit,
+ 'product_uom': purchase_order.order_line[0].product_uom.id,
+ 'product_qty': 42.0})]
+ })
+ work_acceptance.button_accept()
+ self.assertEqual(work_acceptance.state, 'accept')
+ self.assertEqual(purchase_order.wa_count, 1)
+ # Received Products
+ picking = purchase_order.picking_ids[0]
+ self.assertEqual(len(picking.move_ids_without_package), 1)
+ picking.wa_id = work_acceptance
+ picking._onchange_wa_id()
+
+ with self.assertRaises(ValidationError):
+ picking.move_ids_without_package[0].quantity_done = 30.0
+ picking.button_validate()
+ picking.move_ids_without_package[0].quantity_done = 42.0
+ picking.button_validate()
+ # Create Vendor Bill
+ invoice = self.env['account.invoice'].create({
+ 'partner_id': self.res_partner.id,
+ 'purchase_id': purchase_order.id,
+ 'account_id': self.res_partner.property_account_payable_id.id,
+ 'type': 'in_invoice',
+ })
+ invoice.purchase_order_change()
+ invoice.wa_id = work_acceptance
+ with self.assertRaises(ValidationError):
+ invoice.invoice_line_ids[0].quantity = 6.0
+ invoice.action_invoice_open()
+ invoice.invoice_line_ids[0].quantity = 42.0
+ invoice.action_invoice_open()
+
+ def test_03_flow_service(self):
+ # Create Purchase Order
+ purchase_order = self.env['purchase.order'].create({
+ 'partner_id': self.res_partner.id,
+ 'order_line': [
+ (0, 0, {'product_id': self.service_product.id,
+ 'product_uom': self.service_product.uom_id.id,
+ 'name': self.service_product.name,
+ 'price_unit': self.service_product.standard_price,
+ 'date_planned': self.date_now,
+ 'product_qty': 30.0})]
+ })
+ purchase_order.button_confirm()
+ self.assertEqual(purchase_order.state, 'purchase')
+ # Create Work Acceptance
+ work_acceptance = self.env['work.acceptance'].create({
+ 'purchase_id': purchase_order.id,
+ 'partner_id': self.res_partner.id,
+ 'responsible_id': self.employee.id,
+ 'date_due': self.date_now,
+ 'date_receive': self.date_now,
+ 'company_id': self.env.ref('base.main_company').id,
+ 'wa_line_ids': [
+ (0, 0, {'purchase_line_id': purchase_order.order_line[0].id,
+ 'product_id': purchase_order.order_line[0].product_id.id,
+ 'name': purchase_order.order_line[0].name,
+ 'price_unit': purchase_order.order_line[0].price_unit,
+ 'product_uom': purchase_order.order_line[0].product_uom.id,
+ 'product_qty': 30.0})]
+ })
+ work_acceptance.button_accept()
+ self.assertEqual(work_acceptance.state, 'accept')
+ self.assertEqual(purchase_order.wa_count, 1)
+ # Create Vendor Bill
+ purchase_order.with_context(create_bill=True).action_view_invoice()
+ wizard = self.env['select.work.acceptance.wizard'].create({
+ 'wa_id': work_acceptance.id,
+ })
+ wizard.button_create_vendor_bill()
+ invoice = self.env['account.invoice'].create({
+ 'partner_id': self.res_partner.id,
+ 'purchase_id': purchase_order.id,
+ 'account_id': self.res_partner.property_account_payable_id.id,
+ 'type': 'in_invoice',
+ })
+ invoice.wa_id = work_acceptance
+ invoice.purchase_order_change()
+ self.assertEqual(invoice.state, 'draft')
+ invoice.action_invoice_open()
diff --git a/purchase_work_acceptance/views/account_invoice_views.xml b/purchase_work_acceptance/views/account_invoice_views.xml
new file mode 100644
index 00000000000..2ae663e94a0
--- /dev/null
+++ b/purchase_work_acceptance/views/account_invoice_views.xml
@@ -0,0 +1,22 @@
+
+
+
+
+ account.invoice.supplier.form
+ account.invoice
+
+
+
+
+
+
+
+
+
+
diff --git a/purchase_work_acceptance/views/purchase_views.xml b/purchase_work_acceptance/views/purchase_views.xml
new file mode 100644
index 00000000000..fafc580ee81
--- /dev/null
+++ b/purchase_work_acceptance/views/purchase_views.xml
@@ -0,0 +1,37 @@
+
+
+
+
+ purchase.order.form.inherit
+ purchase.order
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {'column_invisible': [('parent.state', 'not in', ('purchase', 'done'))], 'readonly': ['|', ('product_type', 'in', ('consu', 'product')), ('wa_line_ids', '!=', ())]}
+
+
+
+
+
diff --git a/purchase_work_acceptance/views/res_config_settings_views.xml b/purchase_work_acceptance/views/res_config_settings_views.xml
new file mode 100644
index 00000000000..d9e977eab09
--- /dev/null
+++ b/purchase_work_acceptance/views/res_config_settings_views.xml
@@ -0,0 +1,44 @@
+
+
+
+
+ res.config.settings.view.form.inherit.purchase
+ res.config.settings
+
+
+
+
+ Work Acceptance
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/purchase_work_acceptance/views/stock_picking_views.xml b/purchase_work_acceptance/views/stock_picking_views.xml
new file mode 100644
index 00000000000..397e30844e3
--- /dev/null
+++ b/purchase_work_acceptance/views/stock_picking_views.xml
@@ -0,0 +1,22 @@
+
+
+
+
+ stock.picking.form
+ stock.picking
+
+
+
+
+
+
+
+
+
+
diff --git a/purchase_work_acceptance/views/work_acceptance_views.xml b/purchase_work_acceptance/views/work_acceptance_views.xml
new file mode 100644
index 00000000000..816b9b2a9e8
--- /dev/null
+++ b/purchase_work_acceptance/views/work_acceptance_views.xml
@@ -0,0 +1,137 @@
+
+
+
+
+ work.acceptance.form
+ work.acceptance
+
+
+
+
+
+
+ work.acceptance.tree
+ work.acceptance
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ work.acceptance.search
+ work.acceptance
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Work Acceptance
+ work.acceptance
+ form
+ tree,form
+
+
+
+
+ Create a new work acceptance
+
+
+
+
+
+
+
diff --git a/purchase_work_acceptance/wizard/__init__.py b/purchase_work_acceptance/wizard/__init__.py
new file mode 100644
index 00000000000..cec65a008ec
--- /dev/null
+++ b/purchase_work_acceptance/wizard/__init__.py
@@ -0,0 +1,3 @@
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+
+from . import select_work_acceptance_wizard
diff --git a/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
new file mode 100644
index 00000000000..0b3e0be2fa2
--- /dev/null
+++ b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
@@ -0,0 +1,41 @@
+# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+
+from odoo import api, fields, models, _
+from odoo.exceptions import ValidationError
+
+
+class SelectWorkAcceptanceWizard(models.TransientModel):
+ _name = 'select.work.acceptance.wizard'
+ _description = 'Select Work Acceptance Wizard'
+
+ require_wa = fields.Boolean(
+ default=lambda self: self._get_require_wa(),
+ )
+ wa_id = fields.Many2one(
+ comodel_name='work.acceptance',
+ string='Work Acceptance',
+ domain=lambda self: [
+ ('state', '=', 'accept'),
+ ('purchase_id', '=', self._context.get('active_id'))]
+ )
+
+ def _get_require_wa(self):
+ return self.env.user.has_group(
+ 'purchase_work_acceptance.group_enforce_wa_on_invoice')
+
+ @api.multi
+ def button_create_vendor_bill(self):
+ order = self.env['purchase.order'].browse(self._context.get('active_id'))
+ if any(invoice.wa_id == self.wa_id for invoice in order.invoice_ids):
+ raise ValidationError(_('%s was used in some bill.') % self.wa_id.name)
+ action = self.env.ref('account.action_vendor_bill_template')
+ result = action.read()[0]
+ result['context'] = {
+ 'type': 'in_invoice',
+ 'default_wa_id': self.wa_id.id,
+ 'default_purchase_id': self._context.get('active_id'),
+ }
+ res = self.env.ref('account.invoice_supplier_form', False)
+ result['views'] = [(res and res.id or False, 'form')]
+ return result
diff --git a/purchase_work_acceptance/wizard/select_work_acceptance_wizard_views.xml b/purchase_work_acceptance/wizard/select_work_acceptance_wizard_views.xml
new file mode 100644
index 00000000000..dc8650810fa
--- /dev/null
+++ b/purchase_work_acceptance/wizard/select_work_acceptance_wizard_views.xml
@@ -0,0 +1,27 @@
+
+
+
+
+ select_work_acceptance_wizard
+ select.work.acceptance.wizard
+ form
+
+
+
+
+
+
+
+
+
+
+
+
From 7b00d279297891f01fe7145f3f1032194cc175d2 Mon Sep 17 00:00:00 2001
From: oca-travis
Date: Tue, 3 Dec 2019 15:45:23 +0000
Subject: [PATCH 002/210] [UPD] Update purchase_work_acceptance.pot
---
.../i18n/purchase_work_acceptance.pot | 596 ++++++++++++++++++
1 file changed, 596 insertions(+)
create mode 100644 purchase_work_acceptance/i18n/purchase_work_acceptance.pot
diff --git a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
new file mode 100644
index 00000000000..623d962e1ce
--- /dev/null
+++ b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
@@ -0,0 +1,596 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * purchase_work_acceptance
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 12.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: purchase_work_acceptance
+#: code:addons/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py:31
+#, python-format
+msgid "%s was used in some bill."
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: code:addons/purchase_work_acceptance/models/stock_picking.py:34
+#, python-format
+msgid "%s was used in some picking."
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_form
+msgid "Accept"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
+msgid "Accepte Date"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
+#: selection:work.acceptance,state:0
+msgid "Accepted"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
+msgid "Accepted By"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__date_accept
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__date_accept
+msgid "Accepted Date"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__access_warning
+msgid "Access warning"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_needaction
+msgid "Action Needed"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__activity_ids
+msgid "Activities"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__activity_state
+msgid "Activity State"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_attachment_count
+msgid "Attachment Count"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_select_work_acceptance_wizard
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_form
+msgid "Cancel"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: selection:work.acceptance,state:0
+msgid "Cancelled"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__company_id
+msgid "Company"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model,name:purchase_work_acceptance.model_res_config_settings
+msgid "Config Settings"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_select_work_acceptance_wizard
+msgid "Create Vendor Bill"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.purchase_order_form_inherit
+msgid "Create WA"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.actions.act_window,help:purchase_work_acceptance.action_work_acceptance
+msgid "Create a new work acceptance"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard__create_uid
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__create_uid
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__create_uid
+msgid "Created by"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard__create_date
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__create_date
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__create_date
+msgid "Created on"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__currency_id
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__currency_id
+msgid "Currency"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__access_url
+msgid "Customer Portal URL"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_form
+msgid "Define your terms and conditions ..."
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__name
+msgid "Description"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard__display_name
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__display_name
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__display_name
+msgid "Display Name"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
+#: selection:work.acceptance,state:0
+msgid "Draft"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__date_due
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__date_due
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
+msgid "Due Date"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_res_config_settings__group_enable_wa_on_in
+#: model:res.groups,name:purchase_work_acceptance.group_enable_wa_on_in
+msgid "Enable WA on Goods Receipt"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_res_config_settings__group_enable_wa_on_po
+#: model:res.groups,name:purchase_work_acceptance.group_enable_wa_on_po
+msgid "Enable WA on Purchase Order"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_res_config_settings__group_enable_wa_on_invoice
+#: model:res.groups,name:purchase_work_acceptance.group_enable_wa_on_invoice
+msgid "Enable WA on Vendor Bill"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_res_config_settings__group_enforce_wa_on_in
+#: model:res.groups,name:purchase_work_acceptance.group_enforce_wa_on_in
+msgid "Enforce WA on Goods Receipt"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_res_config_settings__group_enforce_wa_on_invoice
+#: model:res.groups,name:purchase_work_acceptance.group_enforce_wa_on_invoice
+msgid "Enforce WA on Vendor Bill"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_follower_ids
+msgid "Followers"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_channel_ids
+msgid "Followers (Channels)"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_partner_ids
+msgid "Followers (Partners)"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
+msgid "Group By"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard__id
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__id
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__id
+msgid "ID"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__message_unread
+msgid "If checked new messages require your attention."
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__message_needaction
+msgid "If checked, new messages require your attention."
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__message_has_error
+msgid "If checked, some messages have a delivery error."
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model,name:purchase_work_acceptance.model_account_invoice
+msgid "Invoice"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__invoice_ref
+msgid "Invoice Reference"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_is_follower
+msgid "Is Follower"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard____last_update
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance____last_update
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line____last_update
+msgid "Last Modified on"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard__write_uid
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__write_uid
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__write_uid
+msgid "Last Updated by"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard__write_date
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__write_date
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__write_date
+msgid "Last Updated on"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_main_attachment_id
+msgid "Main Attachment"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_has_error
+msgid "Message Delivery error"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_ids
+msgid "Messages"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
+msgid "My Work Acceptance"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__name
+msgid "Name"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__activity_date_deadline
+msgid "Next Activity Deadline"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__activity_summary
+msgid "Next Activity Summary"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__activity_type_id
+msgid "Next Activity Type"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__notes
+msgid "Notes"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_needaction_counter
+msgid "Number of Actions"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_has_error_counter
+msgid "Number of error"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__message_needaction_counter
+msgid "Number of messages which requires an action"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__message_has_error_counter
+msgid "Number of messages with delivery error"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__message_unread_counter
+msgid "Number of unread messages"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: selection:work.acceptance,activity_state:0
+msgid "Overdue"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__partner_id
+msgid "Partner"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: selection:work.acceptance,activity_state:0
+msgid "Planned"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__access_url
+msgid "Portal Access URL"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__product_id
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__product_id
+msgid "Product"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__product_uom
+msgid "Product Unit of Measure"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_form
+msgid "Products"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model,name:purchase_work_acceptance.model_purchase_order
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__purchase_id
+msgid "Purchase Order"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model,name:purchase_work_acceptance.model_purchase_order_line
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__purchase_line_id
+msgid "Purchase Order Line"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__product_qty
+msgid "Quantity"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
+msgid "Receive Date"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__date_receive
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__date_receive
+msgid "Received Date"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_tree
+msgid "Reference"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_invoice__require_wa
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard__require_wa
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_stock_picking__require_wa
+msgid "Require Wa"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__responsible_id
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__responsible_id
+msgid "Responsible Person"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__activity_user_id
+msgid "Responsible User"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__access_token
+msgid "Security Token"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: code:addons/purchase_work_acceptance/models/purchase.py:71
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_select_work_acceptance_wizard
+#, python-format
+msgid "Select Work Acceptance"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model,name:purchase_work_acceptance.model_select_work_acceptance_wizard
+msgid "Select Work Acceptance Wizard"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_form
+msgid "Set to draft"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__state
+msgid "Status"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__activity_state
+msgid "Status based on activities\n"
+"Overdue: Due date is already passed\n"
+"Today: Activity date is today\n"
+"Planned: Future activities."
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__price_subtotal
+msgid "Subtotal"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,help:purchase_work_acceptance.field_account_invoice__wa_id
+msgid "To control quantity and unit price of the vendor bill, to be according to the quantity and unit price of the work acceptance."
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: selection:work.acceptance,activity_state:0
+msgid "Today"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_form
+msgid "Total"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model,name:purchase_work_acceptance.model_stock_picking
+msgid "Transfer"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__price_unit
+msgid "Unit Price"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_unread
+msgid "Unread Messages"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_unread_counter
+msgid "Unread Messages Counter"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__partner_id
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
+msgid "Vendor"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.purchase_order_form_inherit
+msgid "WA"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order__wa_line_ids
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order_line__wa_line_ids
+msgid "WA Lines"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_invoice__wa_id
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_stock_picking__wa_id
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__wa_id
+msgid "WA Reference"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order__wa_count
+msgid "WA count"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__website_message_ids
+msgid "Website Messages"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__website_message_ids
+msgid "Website communication history"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.actions.act_window,name:purchase_work_acceptance.action_work_acceptance
+#: model:ir.model,name:purchase_work_acceptance.model_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard__wa_id
+#: model:ir.ui.menu,name:purchase_work_acceptance.menu_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.res_config_settings_view_form_purchase
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_form
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_tree
+msgid "Work Acceptance"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model,name:purchase_work_acceptance.model_work_acceptance_line
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_form
+msgid "Work Acceptance Line"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__wa_line_ids
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_form
+msgid "Work Acceptance Lines"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__user_id
+msgid "Work Acceptance Representative"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order__wa_ids
+msgid "Work Acceptances"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: code:addons/purchase_work_acceptance/models/account_invoice.py:72
+#, python-format
+msgid "You cannot validate a bill if Quantity not equal accepted quantity"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: code:addons/purchase_work_acceptance/models/stock_picking.py:57
+#, python-format
+msgid "You cannot validate a transfer if done quantity not equal accepted quantity"
+msgstr ""
+
From b0ceaecb32af18ab612f983cae9308bea9a71d34 Mon Sep 17 00:00:00 2001
From: ps-tubtim
Date: Mon, 9 Mar 2020 15:55:30 +0700
Subject: [PATCH 003/210] [IMP] purchase_work_acceptance: black, isort
---
purchase_work_acceptance/__manifest__.py | 45 ++-
.../models/account_invoice.py | 47 +--
purchase_work_acceptance/models/purchase.py | 110 +++----
.../models/res_config_settings.py | 12 +-
.../models/stock_picking.py | 52 ++--
.../models/work_acceptance.py | 190 +++++--------
.../tests/test_purchase_work_acceptance.py | 268 +++++++++++-------
.../wizard/select_work_acceptance_wizard.py | 40 +--
8 files changed, 402 insertions(+), 362 deletions(-)
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index 1855029b2d0..bbb2e5ae961 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -2,30 +2,25 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
- 'name': 'Purchase Work Acceptance',
- 'version': '12.0.1.0.0',
- 'category': 'Purchase Management',
- 'author': 'Ecosoft, '
- 'Odoo Community Association (OCA)',
- 'license': 'AGPL-3',
- 'website': 'https://github.com/OCA/purchase-workflow',
- 'depends': [
- 'purchase_stock',
+ "name": "Purchase Work Acceptance",
+ "version": "13.0.1.0.0",
+ "category": "Purchase Management",
+ "author": "Ecosoft, " "Odoo Community Association (OCA)",
+ "license": "AGPL-3",
+ "website": "https://github.com/OCA/purchase-workflow",
+ "depends": ["purchase_stock"],
+ "data": [
+ "data/work_acceptance_sequence.xml",
+ "security/ir.model.access.csv",
+ "security/security.xml",
+ "views/account_invoice_views.xml",
+ "views/purchase_views.xml",
+ "views/res_config_settings_views.xml",
+ "views/stock_picking_views.xml",
+ "views/work_acceptance_views.xml",
+ "wizard/select_work_acceptance_wizard_views.xml",
],
- 'data': [
- 'data/work_acceptance_sequence.xml',
- 'security/ir.model.access.csv',
- 'security/security.xml',
- 'views/account_invoice_views.xml',
- 'views/purchase_views.xml',
- 'views/res_config_settings_views.xml',
- 'views/stock_picking_views.xml',
- 'views/work_acceptance_views.xml',
- 'wizard/select_work_acceptance_wizard_views.xml',
- ],
- 'maintainer': [
- 'ps-tubtim',
- ],
- 'installable': True,
- 'development_status': 'Alpha',
+ "maintainer": ["ps-tubtim"],
+ "installable": True,
+ "development_status": "Alpha",
}
diff --git a/purchase_work_acceptance/models/account_invoice.py b/purchase_work_acceptance/models/account_invoice.py
index 52ee9b2fef2..7988398e1a5 100644
--- a/purchase_work_acceptance/models/account_invoice.py
+++ b/purchase_work_acceptance/models/account_invoice.py
@@ -1,42 +1,41 @@
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from odoo import api, fields, models, _
+from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class AccountInvoice(models.Model):
- _inherit = 'account.invoice'
+ _inherit = "account.invoice"
- require_wa = fields.Boolean(
- compute='_compute_require_wa',
- )
+ require_wa = fields.Boolean(compute="_compute_require_wa")
wa_id = fields.Many2one(
- comodel_name='work.acceptance',
- string='WA Reference',
+ comodel_name="work.acceptance",
+ string="WA Reference",
copy=False,
domain=lambda self: [
- ('state', '=', 'accept'),
- ('purchase_id', '=', self._context.get('active_id'))],
- help='To control quantity and unit price of the vendor bill, to be '
- 'according to the quantity and unit price of the work acceptance.',
+ ("state", "=", "accept"),
+ ("purchase_id", "=", self._context.get("active_id")),
+ ],
+ help="To control quantity and unit price of the vendor bill, to be "
+ "according to the quantity and unit price of the work acceptance.",
)
@api.multi
def _compute_require_wa(self):
self.require_wa = self.env.user.has_group(
- 'purchase_work_acceptance.group_enforce_wa_on_invoice')
+ "purchase_work_acceptance.group_enforce_wa_on_invoice"
+ )
def _prepare_invoice_line_from_po_line(self, line):
res = super()._prepare_invoice_line_from_po_line(line)
- wa_line = self.wa_id.wa_line_ids.filtered(
- lambda l: l.purchase_line_id == line)
+ wa_line = self.wa_id.wa_line_ids.filtered(lambda l: l.purchase_line_id == line)
if wa_line:
- res['quantity'] = wa_line.product_qty
- res['uom_id'] = wa_line.product_uom
+ res["quantity"] = wa_line.product_qty
+ res["uom_id"] = wa_line.product_uom
return res
- @api.onchange('purchase_id')
+ @api.onchange("purchase_id")
def purchase_order_change(self):
res = super().purchase_order_change()
if self.wa_id:
@@ -51,7 +50,8 @@ def action_invoice_open(self):
wa_line = {}
for line in rec.wa_id.wa_line_ids:
qty = line.product_uom._compute_quantity(
- line.product_qty, line.product_id.uom_id)
+ line.product_qty, line.product_id.uom_id
+ )
if qty > 0.0:
if line.product_id.id in wa_line.keys():
qty_old = wa_line[line.product_id.id]
@@ -61,7 +61,8 @@ def action_invoice_open(self):
invoice_line = {}
for line in rec.invoice_line_ids:
qty = line.uom_id._compute_quantity(
- line.quantity, line.product_id.uom_id)
+ line.quantity, line.product_id.uom_id
+ )
if qty > 0.0:
if line.product_id.id in invoice_line.keys():
qty_old = invoice_line[line.product_id.id]
@@ -69,6 +70,10 @@ def action_invoice_open(self):
else:
invoice_line[line.product_id.id] = qty
if wa_line != invoice_line:
- raise ValidationError(_('You cannot validate a bill if '
- 'Quantity not equal accepted quantity'))
+ raise ValidationError(
+ _(
+ "You cannot validate a bill if "
+ "Quantity not equal accepted quantity"
+ )
+ )
return super().action_invoice_open()
diff --git a/purchase_work_acceptance/models/purchase.py b/purchase_work_acceptance/models/purchase.py
index dd2d6b6ebfb..22a69507957 100644
--- a/purchase_work_acceptance/models/purchase.py
+++ b/purchase_work_acceptance/models/purchase.py
@@ -1,96 +1,106 @@
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from odoo import api, fields, models, _
+from odoo import _, api, fields, models
class PurchaseOrder(models.Model):
- _inherit = 'purchase.order'
+ _inherit = "purchase.order"
- wa_count = fields.Integer(
- compute='_compute_wa_ids',
- string='WA count',
- default=0,
- )
+ wa_count = fields.Integer(compute="_compute_wa_ids", string="WA count", default=0)
wa_ids = fields.One2many(
- comodel_name='work.acceptance',
- compute='_compute_wa_ids',
- string='Work Acceptances',
+ comodel_name="work.acceptance",
+ compute="_compute_wa_ids",
+ string="Work Acceptances",
)
wa_line_ids = fields.One2many(
- comodel_name='work.acceptance.line',
- inverse_name='purchase_line_id',
+ comodel_name="work.acceptance.line",
+ inverse_name="purchase_line_id",
string="WA Lines",
readonly=True,
)
def _compute_wa_ids(self):
for order in self:
- order.wa_ids = \
- order.mapped('order_line').mapped('wa_line_ids').mapped('wa_id')
+ order.wa_ids = (
+ order.mapped("order_line").mapped("wa_line_ids").mapped("wa_id")
+ )
order.wa_count = len(order.wa_ids)
@api.multi
def action_view_wa(self):
self.ensure_one()
- act = self.env.ref('purchase_work_acceptance.action_work_acceptance')
+ act = self.env.ref("purchase_work_acceptance.action_work_acceptance")
result = act.read()[0]
- create_wa = self.env.context.get('create_wa', False)
- result['context'] = {
- 'default_purchase_id': self.id,
- 'default_partner_id': self.partner_id.id,
- 'default_company_id': self.company_id.id,
- 'default_currency_id': self.currency_id.id,
- 'default_date_due': self.date_planned,
- 'default_wa_line_ids': [(0, 0, {
- 'purchase_line_id': line.id,
- 'name': line.name,
- 'product_uom': line.product_uom.id,
- 'product_id': line.product_id.id,
- 'price_unit': line.price_unit,
- 'product_qty': line._get_product_qty(),
- }) for line in self.order_line if line._get_product_qty() != 0],
+ create_wa = self.env.context.get("create_wa", False)
+ result["context"] = {
+ "default_purchase_id": self.id,
+ "default_partner_id": self.partner_id.id,
+ "default_company_id": self.company_id.id,
+ "default_currency_id": self.currency_id.id,
+ "default_date_due": self.date_planned,
+ "default_wa_line_ids": [
+ (
+ 0,
+ 0,
+ {
+ "purchase_line_id": line.id,
+ "name": line.name,
+ "product_uom": line.product_uom.id,
+ "product_id": line.product_id.id,
+ "price_unit": line.price_unit,
+ "product_qty": line._get_product_qty(),
+ },
+ )
+ for line in self.order_line
+ if line._get_product_qty() != 0
+ ],
}
if len(self.wa_ids) > 1 and not create_wa:
- result['domain'] = "[('id', 'in', " + str(self.wa_ids.ids) + ")]"
+ result["domain"] = "[('id', 'in', " + str(self.wa_ids.ids) + ")]"
else:
res = self.env.ref(
- 'purchase_work_acceptance.view_work_acceptance_form', False)
- result['views'] = [(res and res.id or False, 'form')]
+ "purchase_work_acceptance.view_work_acceptance_form", False
+ )
+ result["views"] = [(res and res.id or False, "form")]
if not create_wa:
- result['res_id'] = self.wa_ids.id or False
+ result["res_id"] = self.wa_ids.id or False
return result
@api.multi
def action_view_invoice(self):
- if self.env.context.get('create_bill', False) and self.env.user.has_group(
- 'purchase_work_acceptance.group_enable_wa_on_invoice'):
+ if self.env.context.get("create_bill", False) and self.env.user.has_group(
+ "purchase_work_acceptance.group_enable_wa_on_invoice"
+ ):
wizard = self.env.ref(
- 'purchase_work_acceptance.view_select_work_acceptance_wizard')
+ "purchase_work_acceptance.view_select_work_acceptance_wizard"
+ )
return {
- 'name': _('Select Work Acceptance'),
- 'type': 'ir.actions.act_window',
- 'view_type': 'form',
- 'view_mode': 'form',
- 'res_model': 'select.work.acceptance.wizard',
- 'views': [(wizard.id, 'form')],
- 'view_id': wizard.id,
- 'target': 'new',
+ "name": _("Select Work Acceptance"),
+ "type": "ir.actions.act_window",
+ "view_type": "form",
+ "view_mode": "form",
+ "res_model": "select.work.acceptance.wizard",
+ "views": [(wizard.id, "form")],
+ "view_id": wizard.id,
+ "target": "new",
}
return super(PurchaseOrder, self).action_view_invoice()
class PurchaseOrderLine(models.Model):
- _inherit = 'purchase.order.line'
+ _inherit = "purchase.order.line"
wa_line_ids = fields.One2many(
- comodel_name='work.acceptance.line',
- inverse_name='purchase_line_id',
+ comodel_name="work.acceptance.line",
+ inverse_name="purchase_line_id",
string="WA Lines",
readonly=True,
)
def _get_product_qty(self):
return self.product_qty - sum(
- wa_line.product_qty for wa_line in self.wa_line_ids
- if wa_line.wa_id.state != 'cancel')
+ wa_line.product_qty
+ for wa_line in self.wa_line_ids
+ if wa_line.wa_id.state != "cancel"
+ )
diff --git a/purchase_work_acceptance/models/res_config_settings.py b/purchase_work_acceptance/models/res_config_settings.py
index e8814a1f213..3320f9e8f87 100644
--- a/purchase_work_acceptance/models/res_config_settings.py
+++ b/purchase_work_acceptance/models/res_config_settings.py
@@ -5,25 +5,25 @@
class ResConfigSettings(models.TransientModel):
- _inherit = 'res.config.settings'
+ _inherit = "res.config.settings"
group_enable_wa_on_po = fields.Boolean(
string="Enable WA on Purchase Order",
- implied_group='purchase_work_acceptance.group_enable_wa_on_po',
+ implied_group="purchase_work_acceptance.group_enable_wa_on_po",
)
group_enable_wa_on_in = fields.Boolean(
string="Enable WA on Goods Receipt",
- implied_group='purchase_work_acceptance.group_enable_wa_on_in',
+ implied_group="purchase_work_acceptance.group_enable_wa_on_in",
)
group_enforce_wa_on_in = fields.Boolean(
string="Enforce WA on Goods Receipt",
- implied_group='purchase_work_acceptance.group_enforce_wa_on_in',
+ implied_group="purchase_work_acceptance.group_enforce_wa_on_in",
)
group_enable_wa_on_invoice = fields.Boolean(
string="Enable WA on Vendor Bill",
- implied_group='purchase_work_acceptance.group_enable_wa_on_invoice',
+ implied_group="purchase_work_acceptance.group_enable_wa_on_invoice",
)
group_enforce_wa_on_invoice = fields.Boolean(
string="Enforce WA on Vendor Bill",
- implied_group='purchase_work_acceptance.group_enforce_wa_on_invoice',
+ implied_group="purchase_work_acceptance.group_enforce_wa_on_invoice",
)
diff --git a/purchase_work_acceptance/models/stock_picking.py b/purchase_work_acceptance/models/stock_picking.py
index f729f9c06f3..2b4b0d0d406 100644
--- a/purchase_work_acceptance/models/stock_picking.py
+++ b/purchase_work_acceptance/models/stock_picking.py
@@ -1,43 +1,47 @@
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from odoo import api, fields, models, _
+from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class Picking(models.Model):
_inherit = "stock.picking"
- require_wa = fields.Boolean(
- compute='_compute_require_wa',
- )
+ require_wa = fields.Boolean(compute="_compute_require_wa")
wa_id = fields.Many2one(
- comodel_name='work.acceptance',
- string='WA Reference',
+ comodel_name="work.acceptance",
+ string="WA Reference",
copy=False,
domain=lambda self: [
- ('state', '=', 'accept'),
- ('purchase_id', '=', self._context.get('active_id'))],
+ ("state", "=", "accept"),
+ ("purchase_id", "=", self._context.get("active_id")),
+ ],
)
@api.multi
def _compute_require_wa(self):
self.require_wa = self.env.user.has_group(
- 'purchase_work_acceptance.group_enforce_wa_on_in')
+ "purchase_work_acceptance.group_enforce_wa_on_in"
+ )
@api.multi
def button_validate(self):
if self.wa_id:
- order = self.env['purchase.order'].browse(self._context.get('active_id'))
- if any(picking.wa_id == self.wa_id and picking != self
- for picking in order.picking_ids):
- raise ValidationError(_(
- '%s was used in some picking.') % self.wa_id.name)
+ order = self.env["purchase.order"].browse(self._context.get("active_id"))
+ if any(
+ picking.wa_id == self.wa_id and picking != self
+ for picking in order.picking_ids
+ ):
+ raise ValidationError(
+ _("%s was used in some picking.") % self.wa_id.name
+ )
wa_line = {}
for line in self.wa_id.wa_line_ids:
qty = line.product_uom._compute_quantity(
- line.product_qty, line.product_id.uom_id)
- if qty > 0.0 and line.product_id.type in ['product', 'consu']:
+ line.product_qty, line.product_id.uom_id
+ )
+ if qty > 0.0 and line.product_id.type in ["product", "consu"]:
if line.product_id.id in wa_line.keys():
qty_old = wa_line[line.product_id.id]
wa_line[line.product_id.id] = qty_old + qty
@@ -46,7 +50,8 @@ def button_validate(self):
move_line = {}
for move in self.move_ids_without_package:
qty = move.product_uom._compute_quantity(
- move.quantity_done, line.product_id.uom_id)
+ move.quantity_done, line.product_id.uom_id
+ )
if qty > 0.0:
if move.product_id.id in move_line.keys():
qty_old = move_line[move.product_id.id]
@@ -54,17 +59,22 @@ def button_validate(self):
else:
move_line[move.product_id.id] = qty
if wa_line != move_line:
- raise ValidationError(_('You cannot validate a transfer if done'
- ' quantity not equal accepted quantity'))
+ raise ValidationError(
+ _(
+ "You cannot validate a transfer if done"
+ " quantity not equal accepted quantity"
+ )
+ )
return super(Picking, self).button_validate()
- @api.onchange('wa_id')
+ @api.onchange("wa_id")
def _onchange_wa_id(self):
if self.wa_id:
wa_line = {}
for line in self.wa_id.wa_line_ids:
qty = line.product_uom._compute_quantity(
- line.product_qty, line.product_id.uom_id)
+ line.product_qty, line.product_id.uom_id
+ )
if line.product_id.id in wa_line.keys():
qty_old = wa_line[line.product_id.id]
wa_line[line.product_id.id] = qty_old + qty
diff --git a/purchase_work_acceptance/models/work_acceptance.py b/purchase_work_acceptance/models/work_acceptance.py
index 433f3b9b34c..ca4a2375131 100644
--- a/purchase_work_acceptance/models/work_acceptance.py
+++ b/purchase_work_acceptance/models/work_acceptance.py
@@ -5,116 +5,100 @@
class WorkAcceptance(models.Model):
- _name = 'work.acceptance'
- _inherit = ['mail.thread', 'mail.activity.mixin', 'portal.mixin']
- _description = 'Work Acceptance'
- _order = 'id desc'
+ _name = "work.acceptance"
+ _inherit = ["mail.thread", "mail.activity.mixin", "portal.mixin"]
+ _description = "Work Acceptance"
+ _order = "id desc"
- name = fields.Char(
- required=True,
- index=True,
- copy=False,
- default='New'
- )
+ name = fields.Char(required=True, index=True, copy=False, default="New")
date_due = fields.Datetime(
- string='Due Date',
+ string="Due Date",
required=True,
readonly=True,
- states={'draft': [('readonly', False)]},
+ states={"draft": [("readonly", False)]},
)
date_receive = fields.Datetime(
- string='Received Date',
+ string="Received Date",
default=fields.Datetime.now,
required=True,
readonly=True,
- states={'draft': [('readonly', False)]},
- )
- date_accept = fields.Datetime(
- string='Accepted Date',
- readonly=True,
- )
- invoice_ref = fields.Char(
- string='Invoice Reference',
- copy=False,
+ states={"draft": [("readonly", False)]},
)
+ date_accept = fields.Datetime(string="Accepted Date", readonly=True)
+ invoice_ref = fields.Char(string="Invoice Reference", copy=False)
partner_id = fields.Many2one(
- comodel_name='res.partner',
- string='Vendor',
+ comodel_name="res.partner",
+ string="Vendor",
required=True,
change_default=True,
- track_visibility='always',
+ track_visibility="always",
readonly=True,
- states={'draft': [('readonly', False)]},
+ states={"draft": [("readonly", False)]},
)
responsible_id = fields.Many2one(
- comodel_name='res.users',
- string='Responsible Person',
+ comodel_name="res.users",
+ string="Responsible Person",
default=lambda self: self.env.user,
required=True,
change_default=True,
- track_visibility='always',
+ track_visibility="always",
readonly=True,
- states={'draft': [('readonly', False)]},
+ states={"draft": [("readonly", False)]},
)
currency_id = fields.Many2one(
- comodel_name='res.currency',
- string='Currency',
+ comodel_name="res.currency",
+ string="Currency",
default=lambda self: self.env.user.company_id.currency_id.id,
required=True,
readonly=True,
)
state = fields.Selection(
- [('draft', 'Draft'),
- ('accept', 'Accepted'),
- ('cancel', 'Cancelled')],
- string='Status',
+ [("draft", "Draft"), ("accept", "Accepted"), ("cancel", "Cancelled")],
+ string="Status",
readonly=True,
index=True,
copy=False,
- default='draft',
- track_visibility='onchange'
+ default="draft",
+ track_visibility="onchange",
)
wa_line_ids = fields.One2many(
- comodel_name='work.acceptance.line',
- inverse_name='wa_id',
- string='Work Acceptance Lines',
- )
- notes = fields.Text(
- string='Notes',
+ comodel_name="work.acceptance.line",
+ inverse_name="wa_id",
+ string="Work Acceptance Lines",
)
+ notes = fields.Text(string="Notes")
product_id = fields.Many2one(
- comodel_name='product.product',
- related='wa_line_ids.product_id',
- string='Product',
+ comodel_name="product.product",
+ related="wa_line_ids.product_id",
+ string="Product",
readonly=False,
)
user_id = fields.Many2one(
- comodel_name='res.users',
- string='Work Acceptance Representative',
+ comodel_name="res.users",
+ string="Work Acceptance Representative",
default=lambda self: self.env.user,
index=True,
- track_visibility='onchange',
+ track_visibility="onchange",
)
company_id = fields.Many2one(
- comodel_name='res.company',
- string='Company',
+ comodel_name="res.company",
+ string="Company",
default=lambda self: self.env.user.company_id.id,
required=True,
index=True,
readonly=True,
- states={'draft': [('readonly', False)]},
+ states={"draft": [("readonly", False)]},
)
purchase_id = fields.Many2one(
- comodel_name='purchase.order',
- string='Purchase Order',
- readonly=True,
+ comodel_name="purchase.order", string="Purchase Order", readonly=True
)
@api.model
def create(self, vals):
- if vals.get('name', 'New') == 'New':
- vals['name'] = self.env['ir.sequence'].next_by_code(
- 'work.acceptance') or '/'
+ if vals.get("name", "New") == "New":
+ vals["name"] = (
+ self.env["ir.sequence"].next_by_code("work.acceptance") or "/"
+ )
return super(WorkAcceptance, self).create(vals)
@api.multi
@@ -122,99 +106,77 @@ def button_accept(self, force=False):
self._unlink_zero_quantity()
po_lines = self.purchase_id.order_line
for po_line in po_lines:
- if po_line.product_id.type not in ['product', 'consu']:
+ if po_line.product_id.type not in ["product", "consu"]:
po_line.qty_received = self.wa_line_ids.filtered(
- lambda l: l.purchase_line_id == po_line).product_qty
- self.write({'state': 'accept', 'date_accept': fields.Datetime.now()})
+ lambda l: l.purchase_line_id == po_line
+ ).product_qty
+ self.write({"state": "accept", "date_accept": fields.Datetime.now()})
@api.multi
def button_draft(self):
- self.write({'state': 'draft'})
+ self.write({"state": "draft"})
@api.multi
def button_cancel(self):
- self.write({'state': 'cancel'})
+ self.write({"state": "cancel"})
def _unlink_zero_quantity(self):
wa_line_zero_quantity = self.wa_line_ids.filtered(
- lambda l: l.product_qty == 0.0)
+ lambda l: l.product_qty == 0.0
+ )
wa_line_zero_quantity.unlink()
class WorkAcceptanceLine(models.Model):
- _name = 'work.acceptance.line'
- _description = 'Work Acceptance Line'
- _order = 'id'
+ _name = "work.acceptance.line"
+ _description = "Work Acceptance Line"
+ _order = "id"
- name = fields.Text(
- string='Description',
- required=True
- )
- product_qty = fields.Float(
- string='Quantity',
- required=True,
- )
+ name = fields.Text(string="Description", required=True)
+ product_qty = fields.Float(string="Quantity", required=True)
product_id = fields.Many2one(
- comodel_name='product.product',
- string='Product',
- required=True,
+ comodel_name="product.product", string="Product", required=True
)
product_uom = fields.Many2one(
- comodel_name='uom.uom',
- string='Product Unit of Measure',
- required=True,
- )
- price_unit = fields.Float(
- string='Unit Price',
- required=True,
- )
- price_subtotal = fields.Monetary(
- compute='_compute_amount',
- string='Subtotal',
+ comodel_name="uom.uom", string="Product Unit of Measure", required=True
)
+ price_unit = fields.Float(string="Unit Price", required=True)
+ price_subtotal = fields.Monetary(compute="_compute_amount", string="Subtotal")
wa_id = fields.Many2one(
- comodel_name='work.acceptance',
- string='WA Reference',
+ comodel_name="work.acceptance",
+ string="WA Reference",
index=True,
required=True,
- ondelete='cascade'
+ ondelete="cascade",
)
partner_id = fields.Many2one(
- comodel_name='res.partner',
- related='wa_id.partner_id',
- string='Partner',
+ comodel_name="res.partner",
+ related="wa_id.partner_id",
+ string="Partner",
readonly=True,
)
responsible_id = fields.Many2one(
- comodel_name='res.users',
- related='wa_id.responsible_id',
- string='Responsible Person',
+ comodel_name="res.users",
+ related="wa_id.responsible_id",
+ string="Responsible Person",
readonly=True,
)
currency_id = fields.Many2one(
- related='wa_id.currency_id',
- string='Currency',
- readonly=True,
+ related="wa_id.currency_id", string="Currency", readonly=True
)
date_due = fields.Datetime(
- related='wa_id.date_due',
- string='Due Date',
- readonly=True,
+ related="wa_id.date_due", string="Due Date", readonly=True
)
date_receive = fields.Datetime(
- related='wa_id.date_receive',
- string='Received Date',
- readonly=True,
+ related="wa_id.date_receive", string="Received Date", readonly=True
)
date_accept = fields.Datetime(
- related='wa_id.date_accept',
- string='Accepted Date',
- readonly=True,
+ related="wa_id.date_accept", string="Accepted Date", readonly=True
)
purchase_line_id = fields.Many2one(
- comodel_name='purchase.order.line',
- string='Purchase Order Line',
- ondelete='set null',
+ comodel_name="purchase.order.line",
+ string="Purchase Order Line",
+ ondelete="set null",
index=True,
readonly=True,
)
diff --git a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
index 992452658d5..4610903ae99 100644
--- a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
+++ b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
@@ -3,96 +3,132 @@
from odoo import fields
from odoo.exceptions import ValidationError
-from odoo.tests.common import TransactionCase, Form
+from odoo.tests.common import Form, TransactionCase
class TestPurchaseWorkAcceptance(TransactionCase):
def setUp(self):
super(TestPurchaseWorkAcceptance, self).setUp()
# Create Product
- self.service_product = self.env.ref('product.product_product_1')
- self.product_product = self.env.ref('product.product_product_6')
+ self.service_product = self.env.ref("product.product_product_1")
+ self.product_product = self.env.ref("product.product_product_6")
# Create Vendor
- self.res_partner = self.env.ref('base.res_partner_3')
+ self.res_partner = self.env.ref("base.res_partner_3")
# Create Employee
- self.employee = self.env.ref('base.user_demo')
+ self.employee = self.env.ref("base.user_demo")
# Create Date
self.date_now = fields.Datetime.now()
def test_00_wa_button(self):
- work_acceptance = self.env['work.acceptance'].create({
- 'partner_id': self.res_partner.id,
- 'responsible_id': self.employee.id,
- 'date_due': self.date_now,
- 'date_receive': self.date_now,
- 'company_id': self.env.ref('base.main_company').id,
- 'wa_line_ids': [
- (0, 0, {'product_id': self.service_product.id,
- 'name': self.service_product.name,
- 'price_unit': self.service_product.standard_price,
- 'product_qty': 3.0,
- 'product_uom': self.service_product.uom_id.id,
- })]
- })
+ work_acceptance = self.env["work.acceptance"].create(
+ {
+ "partner_id": self.res_partner.id,
+ "responsible_id": self.employee.id,
+ "date_due": self.date_now,
+ "date_receive": self.date_now,
+ "company_id": self.env.ref("base.main_company").id,
+ "wa_line_ids": [
+ (
+ 0,
+ 0,
+ {
+ "product_id": self.service_product.id,
+ "name": self.service_product.name,
+ "price_unit": self.service_product.standard_price,
+ "product_qty": 3.0,
+ "product_uom": self.service_product.uom_id.id,
+ },
+ )
+ ],
+ }
+ )
work_acceptance.button_accept()
- self.assertEqual(work_acceptance.state, 'accept')
+ self.assertEqual(work_acceptance.state, "accept")
work_acceptance.button_cancel()
- self.assertEqual(work_acceptance.state, 'cancel')
+ self.assertEqual(work_acceptance.state, "cancel")
work_acceptance.button_draft()
- self.assertEqual(work_acceptance.state, 'draft')
+ self.assertEqual(work_acceptance.state, "draft")
def test_01_action_view_wa(self):
# Create Purchase Order
- purchase_order = self.env['purchase.order'].create({
- 'partner_id': self.res_partner.id,
- 'order_line': [
- (0, 0, {'product_id': self.service_product.id,
- 'product_uom': self.service_product.uom_id.id,
- 'name': self.service_product.name,
- 'price_unit': self.service_product.standard_price,
- 'date_planned': self.date_now,
- 'product_qty': 42.0})]})
+ purchase_order = self.env["purchase.order"].create(
+ {
+ "partner_id": self.res_partner.id,
+ "order_line": [
+ (
+ 0,
+ 0,
+ {
+ "product_id": self.service_product.id,
+ "product_uom": self.service_product.uom_id.id,
+ "name": self.service_product.name,
+ "price_unit": self.service_product.standard_price,
+ "date_planned": self.date_now,
+ "product_qty": 42.0,
+ },
+ )
+ ],
+ }
+ )
purchase_order.button_confirm()
- self.assertEqual(purchase_order.state, 'purchase')
+ self.assertEqual(purchase_order.state, "purchase")
res = purchase_order.with_context(create_wa=True).action_view_wa()
- ctx = res.get('context')
- work_acceptance = Form(self.env['work.acceptance'].with_context(ctx))
- self.assertEqual(work_acceptance.state, 'draft')
+ ctx = res.get("context")
+ work_acceptance = Form(self.env["work.acceptance"].with_context(ctx))
+ self.assertEqual(work_acceptance.state, "draft")
def test_02_flow_product(self):
# Create Purchase Order
- purchase_order = self.env['purchase.order'].create({
- 'partner_id': self.res_partner.id,
- 'order_line': [
- (0, 0, {'product_id': self.product_product.id,
- 'product_uom': self.product_product.uom_id.id,
- 'name': self.product_product.name,
- 'price_unit': self.product_product.standard_price,
- 'date_planned': self.date_now,
- 'product_qty': 42.0})]
- })
+ purchase_order = self.env["purchase.order"].create(
+ {
+ "partner_id": self.res_partner.id,
+ "order_line": [
+ (
+ 0,
+ 0,
+ {
+ "product_id": self.product_product.id,
+ "product_uom": self.product_product.uom_id.id,
+ "name": self.product_product.name,
+ "price_unit": self.product_product.standard_price,
+ "date_planned": self.date_now,
+ "product_qty": 42.0,
+ },
+ )
+ ],
+ }
+ )
purchase_order.button_confirm()
- self.assertEqual(purchase_order.state, 'purchase')
+ self.assertEqual(purchase_order.state, "purchase")
self.assertEqual(purchase_order.picking_count, 1)
# Create Work Acceptance
- work_acceptance = self.env['work.acceptance'].create({
- 'purchase_id': purchase_order.id,
- 'partner_id': self.res_partner.id,
- 'responsible_id': self.employee.id,
- 'date_due': self.date_now,
- 'date_receive': self.date_now,
- 'company_id': self.env.ref('base.main_company').id,
- 'wa_line_ids': [
- (0, 0, {'purchase_line_id': purchase_order.order_line[0].id,
- 'product_id': purchase_order.order_line[0].product_id.id,
- 'name': purchase_order.order_line[0].name,
- 'price_unit': purchase_order.order_line[0].price_unit,
- 'product_uom': purchase_order.order_line[0].product_uom.id,
- 'product_qty': 42.0})]
- })
+ work_acceptance = self.env["work.acceptance"].create(
+ {
+ "purchase_id": purchase_order.id,
+ "partner_id": self.res_partner.id,
+ "responsible_id": self.employee.id,
+ "date_due": self.date_now,
+ "date_receive": self.date_now,
+ "company_id": self.env.ref("base.main_company").id,
+ "wa_line_ids": [
+ (
+ 0,
+ 0,
+ {
+ "purchase_line_id": purchase_order.order_line[0].id,
+ "product_id": purchase_order.order_line[0].product_id.id,
+ "name": purchase_order.order_line[0].name,
+ "price_unit": purchase_order.order_line[0].price_unit,
+ "product_uom": purchase_order.order_line[0].product_uom.id,
+ "product_qty": 42.0,
+ },
+ )
+ ],
+ }
+ )
work_acceptance.button_accept()
- self.assertEqual(work_acceptance.state, 'accept')
+ self.assertEqual(work_acceptance.state, "accept")
self.assertEqual(purchase_order.wa_count, 1)
# Received Products
picking = purchase_order.picking_ids[0]
@@ -106,12 +142,14 @@ def test_02_flow_product(self):
picking.move_ids_without_package[0].quantity_done = 42.0
picking.button_validate()
# Create Vendor Bill
- invoice = self.env['account.invoice'].create({
- 'partner_id': self.res_partner.id,
- 'purchase_id': purchase_order.id,
- 'account_id': self.res_partner.property_account_payable_id.id,
- 'type': 'in_invoice',
- })
+ invoice = self.env["account.invoice"].create(
+ {
+ "partner_id": self.res_partner.id,
+ "purchase_id": purchase_order.id,
+ "account_id": self.res_partner.property_account_payable_id.id,
+ "type": "in_invoice",
+ }
+ )
invoice.purchase_order_change()
invoice.wa_id = work_acceptance
with self.assertRaises(ValidationError):
@@ -122,50 +160,70 @@ def test_02_flow_product(self):
def test_03_flow_service(self):
# Create Purchase Order
- purchase_order = self.env['purchase.order'].create({
- 'partner_id': self.res_partner.id,
- 'order_line': [
- (0, 0, {'product_id': self.service_product.id,
- 'product_uom': self.service_product.uom_id.id,
- 'name': self.service_product.name,
- 'price_unit': self.service_product.standard_price,
- 'date_planned': self.date_now,
- 'product_qty': 30.0})]
- })
+ purchase_order = self.env["purchase.order"].create(
+ {
+ "partner_id": self.res_partner.id,
+ "order_line": [
+ (
+ 0,
+ 0,
+ {
+ "product_id": self.service_product.id,
+ "product_uom": self.service_product.uom_id.id,
+ "name": self.service_product.name,
+ "price_unit": self.service_product.standard_price,
+ "date_planned": self.date_now,
+ "product_qty": 30.0,
+ },
+ )
+ ],
+ }
+ )
purchase_order.button_confirm()
- self.assertEqual(purchase_order.state, 'purchase')
+ self.assertEqual(purchase_order.state, "purchase")
# Create Work Acceptance
- work_acceptance = self.env['work.acceptance'].create({
- 'purchase_id': purchase_order.id,
- 'partner_id': self.res_partner.id,
- 'responsible_id': self.employee.id,
- 'date_due': self.date_now,
- 'date_receive': self.date_now,
- 'company_id': self.env.ref('base.main_company').id,
- 'wa_line_ids': [
- (0, 0, {'purchase_line_id': purchase_order.order_line[0].id,
- 'product_id': purchase_order.order_line[0].product_id.id,
- 'name': purchase_order.order_line[0].name,
- 'price_unit': purchase_order.order_line[0].price_unit,
- 'product_uom': purchase_order.order_line[0].product_uom.id,
- 'product_qty': 30.0})]
- })
+ work_acceptance = self.env["work.acceptance"].create(
+ {
+ "purchase_id": purchase_order.id,
+ "partner_id": self.res_partner.id,
+ "responsible_id": self.employee.id,
+ "date_due": self.date_now,
+ "date_receive": self.date_now,
+ "company_id": self.env.ref("base.main_company").id,
+ "wa_line_ids": [
+ (
+ 0,
+ 0,
+ {
+ "purchase_line_id": purchase_order.order_line[0].id,
+ "product_id": purchase_order.order_line[0].product_id.id,
+ "name": purchase_order.order_line[0].name,
+ "price_unit": purchase_order.order_line[0].price_unit,
+ "product_uom": purchase_order.order_line[0].product_uom.id,
+ "product_qty": 30.0,
+ },
+ )
+ ],
+ }
+ )
work_acceptance.button_accept()
- self.assertEqual(work_acceptance.state, 'accept')
+ self.assertEqual(work_acceptance.state, "accept")
self.assertEqual(purchase_order.wa_count, 1)
# Create Vendor Bill
purchase_order.with_context(create_bill=True).action_view_invoice()
- wizard = self.env['select.work.acceptance.wizard'].create({
- 'wa_id': work_acceptance.id,
- })
+ wizard = self.env["select.work.acceptance.wizard"].create(
+ {"wa_id": work_acceptance.id}
+ )
wizard.button_create_vendor_bill()
- invoice = self.env['account.invoice'].create({
- 'partner_id': self.res_partner.id,
- 'purchase_id': purchase_order.id,
- 'account_id': self.res_partner.property_account_payable_id.id,
- 'type': 'in_invoice',
- })
+ invoice = self.env["account.invoice"].create(
+ {
+ "partner_id": self.res_partner.id,
+ "purchase_id": purchase_order.id,
+ "account_id": self.res_partner.property_account_payable_id.id,
+ "type": "in_invoice",
+ }
+ )
invoice.wa_id = work_acceptance
invoice.purchase_order_change()
- self.assertEqual(invoice.state, 'draft')
+ self.assertEqual(invoice.state, "draft")
invoice.action_invoice_open()
diff --git a/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
index 0b3e0be2fa2..185fec1f8f0 100644
--- a/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
+++ b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
@@ -1,41 +1,41 @@
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-from odoo import api, fields, models, _
+from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
class SelectWorkAcceptanceWizard(models.TransientModel):
- _name = 'select.work.acceptance.wizard'
- _description = 'Select Work Acceptance Wizard'
+ _name = "select.work.acceptance.wizard"
+ _description = "Select Work Acceptance Wizard"
- require_wa = fields.Boolean(
- default=lambda self: self._get_require_wa(),
- )
+ require_wa = fields.Boolean(default=lambda self: self._get_require_wa())
wa_id = fields.Many2one(
- comodel_name='work.acceptance',
- string='Work Acceptance',
+ comodel_name="work.acceptance",
+ string="Work Acceptance",
domain=lambda self: [
- ('state', '=', 'accept'),
- ('purchase_id', '=', self._context.get('active_id'))]
+ ("state", "=", "accept"),
+ ("purchase_id", "=", self._context.get("active_id")),
+ ],
)
def _get_require_wa(self):
return self.env.user.has_group(
- 'purchase_work_acceptance.group_enforce_wa_on_invoice')
+ "purchase_work_acceptance.group_enforce_wa_on_invoice"
+ )
@api.multi
def button_create_vendor_bill(self):
- order = self.env['purchase.order'].browse(self._context.get('active_id'))
+ order = self.env["purchase.order"].browse(self._context.get("active_id"))
if any(invoice.wa_id == self.wa_id for invoice in order.invoice_ids):
- raise ValidationError(_('%s was used in some bill.') % self.wa_id.name)
- action = self.env.ref('account.action_vendor_bill_template')
+ raise ValidationError(_("%s was used in some bill.") % self.wa_id.name)
+ action = self.env.ref("account.action_vendor_bill_template")
result = action.read()[0]
- result['context'] = {
- 'type': 'in_invoice',
- 'default_wa_id': self.wa_id.id,
- 'default_purchase_id': self._context.get('active_id'),
+ result["context"] = {
+ "type": "in_invoice",
+ "default_wa_id": self.wa_id.id,
+ "default_purchase_id": self._context.get("active_id"),
}
- res = self.env.ref('account.invoice_supplier_form', False)
- result['views'] = [(res and res.id or False, 'form')]
+ res = self.env.ref("account.invoice_supplier_form", False)
+ result["views"] = [(res and res.id or False, "form")]
return result
From 35c27fd2406857833c94f3c52863e9571057bf84 Mon Sep 17 00:00:00 2001
From: ps-tubtim
Date: Wed, 11 Mar 2020 16:43:32 +0700
Subject: [PATCH 004/210] [MIG] purchase_work_acceptance: Migration to 13.0
---
purchase_work_acceptance/__manifest__.py | 4 +-
.../data/work_acceptance_sequence.xml | 6 +-
purchase_work_acceptance/models/__init__.py | 2 +-
.../{account_invoice.py => account_move.py} | 32 +-
purchase_work_acceptance/models/purchase.py | 15 +-
.../models/stock_picking.py | 2 -
.../models/work_acceptance.py | 5 +-
.../readme/CONTRIBUTORS.rst | 4 +-
purchase_work_acceptance/readme/USAGE.rst | 2 +-
.../security/security.xml | 18 +-
.../tests/test_purchase_work_acceptance.py | 44 ++-
.../views/account_invoice_views.xml | 22 --
.../views/account_move_views.xml | 21 ++
.../views/purchase_views.xml | 49 +--
.../views/res_config_settings_views.xml | 77 +++--
.../views/stock_picking_views.xml | 19 +-
.../views/work_acceptance_views.xml | 283 ++++++++++++------
.../wizard/select_work_acceptance_wizard.py | 10 +-
.../select_work_acceptance_wizard_views.xml | 36 +--
19 files changed, 382 insertions(+), 269 deletions(-)
rename purchase_work_acceptance/models/{account_invoice.py => account_move.py} (71%)
delete mode 100644 purchase_work_acceptance/views/account_invoice_views.xml
create mode 100644 purchase_work_acceptance/views/account_move_views.xml
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index bbb2e5ae961..b3d36daad34 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -5,7 +5,7 @@
"name": "Purchase Work Acceptance",
"version": "13.0.1.0.0",
"category": "Purchase Management",
- "author": "Ecosoft, " "Odoo Community Association (OCA)",
+ "author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/purchase-workflow",
"depends": ["purchase_stock"],
@@ -13,7 +13,7 @@
"data/work_acceptance_sequence.xml",
"security/ir.model.access.csv",
"security/security.xml",
- "views/account_invoice_views.xml",
+ "views/account_move_views.xml",
"views/purchase_views.xml",
"views/res_config_settings_views.xml",
"views/stock_picking_views.xml",
diff --git a/purchase_work_acceptance/data/work_acceptance_sequence.xml b/purchase_work_acceptance/data/work_acceptance_sequence.xml
index 12cfb883d7b..0fa20f65037 100644
--- a/purchase_work_acceptance/data/work_acceptance_sequence.xml
+++ b/purchase_work_acceptance/data/work_acceptance_sequence.xml
@@ -1,14 +1,12 @@
-
+
-
Work Acceptance
work.acceptance
WA
5
-
+
-
diff --git a/purchase_work_acceptance/models/__init__.py b/purchase_work_acceptance/models/__init__.py
index ec77fa9ef3e..eed2998d2ca 100644
--- a/purchase_work_acceptance/models/__init__.py
+++ b/purchase_work_acceptance/models/__init__.py
@@ -1,6 +1,6 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from . import account_invoice
+from . import account_move
from . import purchase
from . import res_config_settings
from . import stock_picking
diff --git a/purchase_work_acceptance/models/account_invoice.py b/purchase_work_acceptance/models/account_move.py
similarity index 71%
rename from purchase_work_acceptance/models/account_invoice.py
rename to purchase_work_acceptance/models/account_move.py
index 7988398e1a5..a7034707ee6 100644
--- a/purchase_work_acceptance/models/account_invoice.py
+++ b/purchase_work_acceptance/models/account_move.py
@@ -5,8 +5,8 @@
from odoo.exceptions import ValidationError
-class AccountInvoice(models.Model):
- _inherit = "account.invoice"
+class AccountMove(models.Model):
+ _inherit = "account.move"
require_wa = fields.Boolean(compute="_compute_require_wa")
wa_id = fields.Many2one(
@@ -21,30 +21,20 @@ class AccountInvoice(models.Model):
"according to the quantity and unit price of the work acceptance.",
)
- @api.multi
def _compute_require_wa(self):
self.require_wa = self.env.user.has_group(
"purchase_work_acceptance.group_enforce_wa_on_invoice"
)
- def _prepare_invoice_line_from_po_line(self, line):
- res = super()._prepare_invoice_line_from_po_line(line)
- wa_line = self.wa_id.wa_line_ids.filtered(lambda l: l.purchase_line_id == line)
- if wa_line:
- res["quantity"] = wa_line.product_qty
- res["uom_id"] = wa_line.product_uom
- return res
-
- @api.onchange("purchase_id")
- def purchase_order_change(self):
- res = super().purchase_order_change()
+ @api.onchange("purchase_vendor_bill_id", "purchase_id")
+ def _onchange_purchase_auto_complete(self):
+ res = super()._onchange_purchase_auto_complete()
if self.wa_id:
- self.reference = self.wa_id.invoice_ref
+ self.ref = self.wa_id.invoice_ref
self.currency_id = self.wa_id.currency_id
return res
- @api.multi
- def action_invoice_open(self):
+ def action_post(self):
for rec in self:
if rec.wa_id:
wa_line = {}
@@ -60,7 +50,7 @@ def action_invoice_open(self):
wa_line[line.product_id.id] = qty
invoice_line = {}
for line in rec.invoice_line_ids:
- qty = line.uom_id._compute_quantity(
+ qty = line.product_uom_id._compute_quantity(
line.quantity, line.product_id.uom_id
)
if qty > 0.0:
@@ -72,8 +62,8 @@ def action_invoice_open(self):
if wa_line != invoice_line:
raise ValidationError(
_(
- "You cannot validate a bill if "
- "Quantity not equal accepted quantity"
+ "You cannot validate a bill if Quantity not equal "
+ "accepted quantity"
)
)
- return super().action_invoice_open()
+ return super().action_post()
diff --git a/purchase_work_acceptance/models/purchase.py b/purchase_work_acceptance/models/purchase.py
index 22a69507957..86598c517e6 100644
--- a/purchase_work_acceptance/models/purchase.py
+++ b/purchase_work_acceptance/models/purchase.py
@@ -1,7 +1,7 @@
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from odoo import _, api, fields, models
+from odoo import _, fields, models
class PurchaseOrder(models.Model):
@@ -27,7 +27,6 @@ def _compute_wa_ids(self):
)
order.wa_count = len(order.wa_ids)
- @api.multi
def action_view_wa(self):
self.ensure_one()
act = self.env.ref("purchase_work_acceptance.action_work_acceptance")
@@ -67,7 +66,6 @@ def action_view_wa(self):
result["res_id"] = self.wa_ids.id or False
return result
- @api.multi
def action_view_invoice(self):
if self.env.context.get("create_bill", False) and self.env.user.has_group(
"purchase_work_acceptance.group_enable_wa_on_invoice"
@@ -78,14 +76,13 @@ def action_view_invoice(self):
return {
"name": _("Select Work Acceptance"),
"type": "ir.actions.act_window",
- "view_type": "form",
"view_mode": "form",
"res_model": "select.work.acceptance.wizard",
"views": [(wizard.id, "form")],
"view_id": wizard.id,
"target": "new",
}
- return super(PurchaseOrder, self).action_view_invoice()
+ return super().action_view_invoice()
class PurchaseOrderLine(models.Model):
@@ -104,3 +101,11 @@ def _get_product_qty(self):
for wa_line in self.wa_line_ids
if wa_line.wa_id.state != "cancel"
)
+
+ def _prepare_account_move_line(self, move):
+ res = super()._prepare_account_move_line(move)
+ if move.wa_id:
+ wa_line = self.wa_line_ids.filtered(lambda l: l.wa_id == move.wa_id)
+ res["quantity"] = wa_line.product_qty
+ res["product_uom_id"] = wa_line.product_uom
+ return res
diff --git a/purchase_work_acceptance/models/stock_picking.py b/purchase_work_acceptance/models/stock_picking.py
index 2b4b0d0d406..814d69832b9 100644
--- a/purchase_work_acceptance/models/stock_picking.py
+++ b/purchase_work_acceptance/models/stock_picking.py
@@ -19,13 +19,11 @@ class Picking(models.Model):
],
)
- @api.multi
def _compute_require_wa(self):
self.require_wa = self.env.user.has_group(
"purchase_work_acceptance.group_enforce_wa_on_in"
)
- @api.multi
def button_validate(self):
if self.wa_id:
order = self.env["purchase.order"].browse(self._context.get("active_id"))
diff --git a/purchase_work_acceptance/models/work_acceptance.py b/purchase_work_acceptance/models/work_acceptance.py
index ca4a2375131..419c735c729 100644
--- a/purchase_work_acceptance/models/work_acceptance.py
+++ b/purchase_work_acceptance/models/work_acceptance.py
@@ -83,7 +83,7 @@ class WorkAcceptance(models.Model):
company_id = fields.Many2one(
comodel_name="res.company",
string="Company",
- default=lambda self: self.env.user.company_id.id,
+ default=lambda self: self.env.company.id,
required=True,
index=True,
readonly=True,
@@ -101,7 +101,6 @@ def create(self, vals):
)
return super(WorkAcceptance, self).create(vals)
- @api.multi
def button_accept(self, force=False):
self._unlink_zero_quantity()
po_lines = self.purchase_id.order_line
@@ -112,11 +111,9 @@ def button_accept(self, force=False):
).product_qty
self.write({"state": "accept", "date_accept": fields.Datetime.now()})
- @api.multi
def button_draft(self):
self.write({"state": "draft"})
- @api.multi
def button_cancel(self):
self.write({"state": "cancel"})
diff --git a/purchase_work_acceptance/readme/CONTRIBUTORS.rst b/purchase_work_acceptance/readme/CONTRIBUTORS.rst
index 0ef1f84c3fd..ea63aa7bc15 100644
--- a/purchase_work_acceptance/readme/CONTRIBUTORS.rst
+++ b/purchase_work_acceptance/readme/CONTRIBUTORS.rst
@@ -1 +1,3 @@
-* Pimolnat Suntian
+* `Ecosoft `__:
+
+ * Pimolnat Suntian
diff --git a/purchase_work_acceptance/readme/USAGE.rst b/purchase_work_acceptance/readme/USAGE.rst
index a9b4a125112..7025c3dcfa3 100644
--- a/purchase_work_acceptance/readme/USAGE.rst
+++ b/purchase_work_acceptance/readme/USAGE.rst
@@ -23,4 +23,4 @@
** Control Vendor Bill by Work Acceptance **
#. After once the products and/or services have been accepted, Click 'Create Bill'
-#. You will be prompted to select a Work Acceptance. Select it and Click 'Create Vendor Bill'
+#. You will be prompted to select a Work Acceptance. Select it and Click 'Post'
diff --git a/purchase_work_acceptance/security/security.xml b/purchase_work_acceptance/security/security.xml
index 2c0f7f4257b..769ccab3829 100644
--- a/purchase_work_acceptance/security/security.xml
+++ b/purchase_work_acceptance/security/security.xml
@@ -1,29 +1,23 @@
-
+
-
Enable WA on Purchase Order
-
+
-
Enable WA on Goods Receipt
-
+
-
Enforce WA on Goods Receipt
-
+
-
Enable WA on Vendor Bill
-
+
-
Enforce WA on Vendor Bill
-
+
-
diff --git a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
index 4610903ae99..f7edd17b456 100644
--- a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
+++ b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
@@ -142,21 +142,20 @@ def test_02_flow_product(self):
picking.move_ids_without_package[0].quantity_done = 42.0
picking.button_validate()
# Create Vendor Bill
- invoice = self.env["account.invoice"].create(
- {
- "partner_id": self.res_partner.id,
- "purchase_id": purchase_order.id,
- "account_id": self.res_partner.property_account_payable_id.id,
- "type": "in_invoice",
- }
- )
- invoice.purchase_order_change()
+ f = Form(self.env["account.move"].with_context(default_type="in_invoice"))
+ f.partner_id = purchase_order.partner_id
+ f.purchase_id = purchase_order
+ # f.wa_id = work_acceptance
+ invoice = f.save()
invoice.wa_id = work_acceptance
+ invoice_line = invoice.invoice_line_ids[0]
with self.assertRaises(ValidationError):
- invoice.invoice_line_ids[0].quantity = 6.0
- invoice.action_invoice_open()
- invoice.invoice_line_ids[0].quantity = 42.0
- invoice.action_invoice_open()
+ invoice_line.with_context(check_move_validity=False).write(
+ {"quantity": 6.0}
+ )
+ invoice.action_post() # Warn when quantity not equal to WA
+ invoice_line.quantity = 42.0
+ invoice.action_post()
def test_03_flow_service(self):
# Create Purchase Order
@@ -214,16 +213,11 @@ def test_03_flow_service(self):
wizard = self.env["select.work.acceptance.wizard"].create(
{"wa_id": work_acceptance.id}
)
- wizard.button_create_vendor_bill()
- invoice = self.env["account.invoice"].create(
- {
- "partner_id": self.res_partner.id,
- "purchase_id": purchase_order.id,
- "account_id": self.res_partner.property_account_payable_id.id,
- "type": "in_invoice",
- }
- )
- invoice.wa_id = work_acceptance
- invoice.purchase_order_change()
+ wiz = wizard.button_create_vendor_bill()
+ f = Form(self.env["account.move"].with_context(wiz.get("context", {})))
+ f.purchase_id = purchase_order
+ invoice = f.save()
+ invoice._onchange_purchase_auto_complete()
self.assertEqual(invoice.state, "draft")
- invoice.action_invoice_open()
+ invoice.action_post()
+ self.assertEqual(invoice.state, "posted")
diff --git a/purchase_work_acceptance/views/account_invoice_views.xml b/purchase_work_acceptance/views/account_invoice_views.xml
deleted file mode 100644
index 2ae663e94a0..00000000000
--- a/purchase_work_acceptance/views/account_invoice_views.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- account.invoice.supplier.form
- account.invoice
-
-
-
-
-
-
-
-
-
-
diff --git a/purchase_work_acceptance/views/account_move_views.xml b/purchase_work_acceptance/views/account_move_views.xml
new file mode 100644
index 00000000000..6e520e37761
--- /dev/null
+++ b/purchase_work_acceptance/views/account_move_views.xml
@@ -0,0 +1,21 @@
+
+
+
+ account.move.form
+ account.move
+
+
+
+
+
+
+
+
+
diff --git a/purchase_work_acceptance/views/purchase_views.xml b/purchase_work_acceptance/views/purchase_views.xml
index fafc580ee81..1b0b8afca4d 100644
--- a/purchase_work_acceptance/views/purchase_views.xml
+++ b/purchase_work_acceptance/views/purchase_views.xml
@@ -1,37 +1,44 @@
-
+
-
purchase.order.form.inherit
purchase.order
-
+
-
+
-
-
-
+
+
+
-
+
-
- {'column_invisible': [('parent.state', 'not in', ('purchase', 'done'))], 'readonly': ['|', ('product_type', 'in', ('consu', 'product')), ('wa_line_ids', '!=', ())]}
+
+ {'column_invisible': [('parent.state', 'not in', ('purchase', 'done'))], 'readonly': ['|', ('product_type', 'in', ('consu', 'product')), ('wa_line_ids', '!=', ())]}
-
diff --git a/purchase_work_acceptance/views/res_config_settings_views.xml b/purchase_work_acceptance/views/res_config_settings_views.xml
index d9e977eab09..aa0e278ac5a 100644
--- a/purchase_work_acceptance/views/res_config_settings_views.xml
+++ b/purchase_work_acceptance/views/res_config_settings_views.xml
@@ -1,37 +1,75 @@
-
+
-
res.config.settings.view.form.inherit.purchase
res.config.settings
-
-
+
+
-
+
Work Acceptance
-
+
-
+
-
-
+
+
-
-
+
+
-
@@ -40,5 +78,4 @@
-
diff --git a/purchase_work_acceptance/views/stock_picking_views.xml b/purchase_work_acceptance/views/stock_picking_views.xml
index 397e30844e3..24c790f1408 100644
--- a/purchase_work_acceptance/views/stock_picking_views.xml
+++ b/purchase_work_acceptance/views/stock_picking_views.xml
@@ -1,22 +1,21 @@
-
+
-
stock.picking.form
stock.picking
-
+
-
-
+
+ />
-
diff --git a/purchase_work_acceptance/views/work_acceptance_views.xml b/purchase_work_acceptance/views/work_acceptance_views.xml
index 816b9b2a9e8..c137b6b5d59 100644
--- a/purchase_work_acceptance/views/work_acceptance_views.xml
+++ b/purchase_work_acceptance/views/work_acceptance_views.xml
@@ -1,137 +1,228 @@
-
+
-
work.acceptance.form
work.acceptance
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
work.acceptance.tree
work.acceptance
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
work.acceptance.search
work.acceptance
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
Work Acceptance
work.acceptance
- form
tree,form
-
-
+
+
Create a new work acceptance
-
-
-
+
diff --git a/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
index 185fec1f8f0..7e9b159c054 100644
--- a/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
+++ b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
@@ -1,7 +1,7 @@
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-from odoo import _, api, fields, models
+from odoo import _, fields, models
from odoo.exceptions import ValidationError
@@ -24,18 +24,18 @@ def _get_require_wa(self):
"purchase_work_acceptance.group_enforce_wa_on_invoice"
)
- @api.multi
def button_create_vendor_bill(self):
order = self.env["purchase.order"].browse(self._context.get("active_id"))
if any(invoice.wa_id == self.wa_id for invoice in order.invoice_ids):
raise ValidationError(_("%s was used in some bill.") % self.wa_id.name)
- action = self.env.ref("account.action_vendor_bill_template")
+ action = self.env.ref("account.action_move_in_invoice_type")
result = action.read()[0]
result["context"] = {
- "type": "in_invoice",
+ "default_type": "in_invoice",
"default_wa_id": self.wa_id.id,
"default_purchase_id": self._context.get("active_id"),
+ "default_company_id": self.wa_id.company_id.id or self.env.company.id,
}
- res = self.env.ref("account.invoice_supplier_form", False)
+ res = self.env.ref("account.view_move_form", False)
result["views"] = [(res and res.id or False, "form")]
return result
diff --git a/purchase_work_acceptance/wizard/select_work_acceptance_wizard_views.xml b/purchase_work_acceptance/wizard/select_work_acceptance_wizard_views.xml
index dc8650810fa..1814112d23f 100644
--- a/purchase_work_acceptance/wizard/select_work_acceptance_wizard_views.xml
+++ b/purchase_work_acceptance/wizard/select_work_acceptance_wizard_views.xml
@@ -1,27 +1,29 @@
-
+
-
select_work_acceptance_wizard
select.work.acceptance.wizard
form
-
-
-
-
-
-
+
+
+
+
+
+
-
From 7e0d0bdd2208c7da12a0374f23785b9ac9e65d6b Mon Sep 17 00:00:00 2001
From: oca-travis
Date: Wed, 8 Jul 2020 11:20:39 +0000
Subject: [PATCH 005/210] [UPD] Update purchase_work_acceptance.pot
---
.../i18n/purchase_work_acceptance.pot | 92 ++++++++++---------
1 file changed, 51 insertions(+), 41 deletions(-)
diff --git a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
index 623d962e1ce..87c96e59491 100644
--- a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
+++ b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
@@ -1,12 +1,12 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * purchase_work_acceptance
+# * purchase_work_acceptance
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 12.0\n"
+"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: <>\n"
+"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -14,13 +14,13 @@ msgstr ""
"Plural-Forms: \n"
#. module: purchase_work_acceptance
-#: code:addons/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py:31
+#: code:addons/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py:0
#, python-format
msgid "%s was used in some bill."
msgstr ""
#. module: purchase_work_acceptance
-#: code:addons/purchase_work_acceptance/models/stock_picking.py:34
+#: code:addons/purchase_work_acceptance/models/stock_picking.py:0
#, python-format
msgid "%s was used in some picking."
msgstr ""
@@ -36,8 +36,8 @@ msgid "Accepte Date"
msgstr ""
#. module: purchase_work_acceptance
+#: model:ir.model.fields.selection,name:purchase_work_acceptance.selection__work_acceptance__state__accept
#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
-#: selection:work.acceptance,state:0
msgid "Accepted"
msgstr ""
@@ -67,6 +67,11 @@ msgstr ""
msgid "Activities"
msgstr ""
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__activity_exception_decoration
+msgid "Activity Exception Decoration"
+msgstr ""
+
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__activity_state
msgid "Activity State"
@@ -84,7 +89,7 @@ msgid "Cancel"
msgstr ""
#. module: purchase_work_acceptance
-#: selection:work.acceptance,state:0
+#: model:ir.model.fields.selection,name:purchase_work_acceptance.selection__work_acceptance__state__cancel
msgid "Cancelled"
msgstr ""
@@ -156,8 +161,8 @@ msgid "Display Name"
msgstr ""
#. module: purchase_work_acceptance
+#: model:ir.model.fields.selection,name:purchase_work_acceptance.selection__work_acceptance__state__draft
#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
-#: selection:work.acceptance,state:0
msgid "Draft"
msgstr ""
@@ -226,25 +231,27 @@ msgid "ID"
msgstr ""
#. module: purchase_work_acceptance
-#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__message_unread
-msgid "If checked new messages require your attention."
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__activity_exception_icon
+msgid "Icon"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__activity_exception_icon
+msgid "Icon to indicate an exception activity."
msgstr ""
#. module: purchase_work_acceptance
#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__message_needaction
+#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__message_unread
msgid "If checked, new messages require your attention."
msgstr ""
#. module: purchase_work_acceptance
#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__message_has_error
+#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__message_has_sms_error
msgid "If checked, some messages have a delivery error."
msgstr ""
-#. module: purchase_work_acceptance
-#: model:ir.model,name:purchase_work_acceptance.model_account_invoice
-msgid "Invoice"
-msgstr ""
-
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__invoice_ref
msgid "Invoice Reference"
@@ -255,6 +262,11 @@ msgstr ""
msgid "Is Follower"
msgstr ""
+#. module: purchase_work_acceptance
+#: model:ir.model,name:purchase_work_acceptance.model_account_move
+msgid "Journal Entries"
+msgstr ""
+
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard____last_update
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance____last_update
@@ -328,7 +340,7 @@ msgstr ""
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_has_error_counter
-msgid "Number of error"
+msgid "Number of errors"
msgstr ""
#. module: purchase_work_acceptance
@@ -346,21 +358,11 @@ msgstr ""
msgid "Number of unread messages"
msgstr ""
-#. module: purchase_work_acceptance
-#: selection:work.acceptance,activity_state:0
-msgid "Overdue"
-msgstr ""
-
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__partner_id
msgid "Partner"
msgstr ""
-#. module: purchase_work_acceptance
-#: selection:work.acceptance,activity_state:0
-msgid "Planned"
-msgstr ""
-
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__access_url
msgid "Portal Access URL"
@@ -417,7 +419,7 @@ msgid "Reference"
msgstr ""
#. module: purchase_work_acceptance
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_invoice__require_wa
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_move__require_wa
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard__require_wa
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_stock_picking__require_wa
msgid "Require Wa"
@@ -434,13 +436,18 @@ msgstr ""
msgid "Responsible User"
msgstr ""
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_has_sms_error
+msgid "SMS Delivery error"
+msgstr ""
+
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__access_token
msgid "Security Token"
msgstr ""
#. module: purchase_work_acceptance
-#: code:addons/purchase_work_acceptance/models/purchase.py:71
+#: code:addons/purchase_work_acceptance/models/purchase.py:0
#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_select_work_acceptance_wizard
#, python-format
msgid "Select Work Acceptance"
@@ -463,7 +470,8 @@ msgstr ""
#. module: purchase_work_acceptance
#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__activity_state
-msgid "Status based on activities\n"
+msgid ""
+"Status based on activities\n"
"Overdue: Due date is already passed\n"
"Today: Activity date is today\n"
"Planned: Future activities."
@@ -475,13 +483,10 @@ msgid "Subtotal"
msgstr ""
#. module: purchase_work_acceptance
-#: model:ir.model.fields,help:purchase_work_acceptance.field_account_invoice__wa_id
-msgid "To control quantity and unit price of the vendor bill, to be according to the quantity and unit price of the work acceptance."
-msgstr ""
-
-#. module: purchase_work_acceptance
-#: selection:work.acceptance,activity_state:0
-msgid "Today"
+#: model:ir.model.fields,help:purchase_work_acceptance.field_account_move__wa_id
+msgid ""
+"To control quantity and unit price of the vendor bill, to be according to "
+"the quantity and unit price of the work acceptance."
msgstr ""
#. module: purchase_work_acceptance
@@ -494,6 +499,11 @@ msgstr ""
msgid "Transfer"
msgstr ""
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__activity_exception_decoration
+msgid "Type of the exception activity on record."
+msgstr ""
+
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__price_unit
msgid "Unit Price"
@@ -527,7 +537,7 @@ msgid "WA Lines"
msgstr ""
#. module: purchase_work_acceptance
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_invoice__wa_id
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_move__wa_id
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_stock_picking__wa_id
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__wa_id
msgid "WA Reference"
@@ -583,14 +593,14 @@ msgid "Work Acceptances"
msgstr ""
#. module: purchase_work_acceptance
-#: code:addons/purchase_work_acceptance/models/account_invoice.py:72
+#: code:addons/purchase_work_acceptance/models/account_move.py:0
#, python-format
msgid "You cannot validate a bill if Quantity not equal accepted quantity"
msgstr ""
#. module: purchase_work_acceptance
-#: code:addons/purchase_work_acceptance/models/stock_picking.py:57
+#: code:addons/purchase_work_acceptance/models/stock_picking.py:0
#, python-format
-msgid "You cannot validate a transfer if done quantity not equal accepted quantity"
+msgid ""
+"You cannot validate a transfer if done quantity not equal accepted quantity"
msgstr ""
-
From 6787c9bab0935d6a25b7ea94c8bd2801cc018f31 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Wed, 8 Jul 2020 11:39:49 +0000
Subject: [PATCH 006/210] [UPD] README.rst
---
purchase_work_acceptance/README.rst | 16 +++++++++-------
.../static/description/index.html | 11 +++++++----
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/purchase_work_acceptance/README.rst b/purchase_work_acceptance/README.rst
index ad8bd431f7f..60d9c8d3d60 100644
--- a/purchase_work_acceptance/README.rst
+++ b/purchase_work_acceptance/README.rst
@@ -14,13 +14,13 @@ Purchase Work Acceptance
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
- :target: https://github.com/OCA/purchase-workflow/tree/12.0/purchase_work_acceptance
+ :target: https://github.com/OCA/purchase-workflow/tree/13.0/purchase_work_acceptance
:alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/purchase-workflow-12-0/purchase-workflow-12-0-purchase_work_acceptance
+ :target: https://translation.odoo-community.org/projects/purchase-workflow-13-0/purchase-workflow-13-0-purchase_work_acceptance
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/142/12.0
+ :target: https://runbot.odoo-community.org/runbot/142/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -101,7 +101,7 @@ Usage
** Control Vendor Bill by Work Acceptance **
#. After once the products and/or services have been accepted, Click 'Create Bill'
-#. You will be prompted to select a Work Acceptance. Select it and Click 'Create Vendor Bill'
+#. You will be prompted to select a Work Acceptance. Select it and Click 'Post'
Bug Tracker
===========
@@ -109,7 +109,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -124,7 +124,9 @@ Authors
Contributors
~~~~~~~~~~~~
-* Pimolnat Suntian
+* `Ecosoft `__:
+
+ * Pimolnat Suntian
Maintainers
~~~~~~~~~~~
@@ -139,6 +141,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-This module is part of the `OCA/purchase-workflow `_ project on GitHub.
+This module is part of the `OCA/purchase-workflow `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/purchase_work_acceptance/static/description/index.html b/purchase_work_acceptance/static/description/index.html
index 9bf6c1f05e4..52e1029c188 100644
--- a/purchase_work_acceptance/static/description/index.html
+++ b/purchase_work_acceptance/static/description/index.html
@@ -367,7 +367,7 @@ Purchase Work Acceptance
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
This module introduces the ability to define a quantity control point on Receipts and Vendor Bills by
Work Acceptance. Only the products and services that have been included in a Work Acceptance can be
received and/or invoiced.
@@ -452,7 +452,7 @@
** Control Vendor Bill by Work Acceptance **
After once the products and/or services have been accepted, Click ‘Create Bill’
-You will be prompted to select a Work Acceptance. Select it and Click ‘Create Vendor Bill’
+You will be prompted to select a Work Acceptance. Select it and Click ‘Post’
@@ -460,7 +460,7 @@
Bugs are tracked on GitHub Issues .
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback .
+
feedback .
Do not contact contributors directly about support or help with technical issues.
@@ -474,8 +474,11 @@
@@ -484,7 +487,7 @@
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-
This module is part of the OCA/purchase-workflow project on GitHub.
+
This module is part of the OCA/purchase-workflow project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute .
From 114abc4c92f8cb551ebfafb30634475f78d86e13 Mon Sep 17 00:00:00 2001
From: Kitti U
Date: Fri, 10 Jul 2020 14:15:53 +0700
Subject: [PATCH 007/210] [FIX] purchase_work_acceptance, no purchase_line_id
in wa_line coz of readonly flag
---
purchase_work_acceptance/models/work_acceptance.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/models/work_acceptance.py b/purchase_work_acceptance/models/work_acceptance.py
index 419c735c729..b6b7b5669b2 100644
--- a/purchase_work_acceptance/models/work_acceptance.py
+++ b/purchase_work_acceptance/models/work_acceptance.py
@@ -175,7 +175,7 @@ class WorkAcceptanceLine(models.Model):
string="Purchase Order Line",
ondelete="set null",
index=True,
- readonly=True,
+ readonly=False,
)
def _compute_amount(self):
From 76e11da9e01775d25b72f926a20fedd7f6c1bba7 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Mon, 13 Jul 2020 11:38:23 +0000
Subject: [PATCH 008/210] purchase_work_acceptance 13.0.1.0.1
---
purchase_work_acceptance/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index b3d36daad34..5a3a07f59ae 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Work Acceptance",
- "version": "13.0.1.0.0",
+ "version": "13.0.1.0.1",
"category": "Purchase Management",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
From bab2624ed7b08b522da4f2b59d3a8103dd443e49 Mon Sep 17 00:00:00 2001
From: ps-tubtim
Date: Thu, 23 Jul 2020 11:02:03 +0700
Subject: [PATCH 009/210] [FIX] purchase_work_acceptance: name repeat in core
---
purchase_work_acceptance/views/res_config_settings_views.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/views/res_config_settings_views.xml b/purchase_work_acceptance/views/res_config_settings_views.xml
index aa0e278ac5a..352108b1c90 100644
--- a/purchase_work_acceptance/views/res_config_settings_views.xml
+++ b/purchase_work_acceptance/views/res_config_settings_views.xml
@@ -13,7 +13,7 @@
Work Acceptance
From f682c4b4bb1817b17c7436e0110e703145507fff Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Wed, 29 Jul 2020 08:26:17 +0000
Subject: [PATCH 010/210] purchase_work_acceptance 13.0.1.0.2
---
purchase_work_acceptance/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index 5a3a07f59ae..2db6e9592f7 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Work Acceptance",
- "version": "13.0.1.0.1",
+ "version": "13.0.1.0.2",
"category": "Purchase Management",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
From 885dab386b282610789403862cc3f060bef162bb Mon Sep 17 00:00:00 2001
From: kranokporn
Date: Fri, 31 Jul 2020 10:14:55 +0700
Subject: [PATCH 011/210] [FIX] onchange quantity, display vendor bills and
test script
---
.../models/account_move.py | 14 +-
.../models/stock_picking.py | 4 +-
.../models/work_acceptance.py | 12 +-
.../tests/test_purchase_work_acceptance.py | 273 +++++++++++-------
.../views/account_move_views.xml | 4 +-
5 files changed, 184 insertions(+), 123 deletions(-)
diff --git a/purchase_work_acceptance/models/account_move.py b/purchase_work_acceptance/models/account_move.py
index a7034707ee6..ffeab4e63cd 100644
--- a/purchase_work_acceptance/models/account_move.py
+++ b/purchase_work_acceptance/models/account_move.py
@@ -13,6 +13,7 @@ class AccountMove(models.Model):
comodel_name="work.acceptance",
string="WA Reference",
copy=False,
+ readonly=True,
domain=lambda self: [
("state", "=", "accept"),
("purchase_id", "=", self._context.get("active_id")),
@@ -22,16 +23,19 @@ class AccountMove(models.Model):
)
def _compute_require_wa(self):
- self.require_wa = self.env.user.has_group(
- "purchase_work_acceptance.group_enforce_wa_on_invoice"
- )
+ for rec in self:
+ enforce_wa = self.env.user.has_group(
+ "purchase_work_acceptance.group_enforce_wa_on_invoice"
+ )
+ rec.require_wa = self.wa_id and enforce_wa
@api.onchange("purchase_vendor_bill_id", "purchase_id")
def _onchange_purchase_auto_complete(self):
res = super()._onchange_purchase_auto_complete()
if self.wa_id:
- self.ref = self.wa_id.invoice_ref
- self.currency_id = self.wa_id.currency_id
+ self.write(
+ {"ref": self.wa_id.invoice_ref, "currency_id": self.wa_id.currency_id}
+ )
return res
def action_post(self):
diff --git a/purchase_work_acceptance/models/stock_picking.py b/purchase_work_acceptance/models/stock_picking.py
index 814d69832b9..381db94fe05 100644
--- a/purchase_work_acceptance/models/stock_picking.py
+++ b/purchase_work_acceptance/models/stock_picking.py
@@ -82,7 +82,7 @@ def _onchange_wa_id(self):
if move_line.product_id.id in wa_line.keys():
qty = wa_line[move_line.product_id.id]
if move_line.product_uom_qty < qty:
- move_line.qty_done = move_line.product_uom_qty
+ move_line._origin.qty_done = move_line.product_uom_qty
wa_line[line.product_id.id] = qty - move_line.product_uom_qty
else:
- move_line.qty_done = qty
+ move_line._origin.qty_done = qty
diff --git a/purchase_work_acceptance/models/work_acceptance.py b/purchase_work_acceptance/models/work_acceptance.py
index b6b7b5669b2..2f03a6cb15d 100644
--- a/purchase_work_acceptance/models/work_acceptance.py
+++ b/purchase_work_acceptance/models/work_acceptance.py
@@ -1,7 +1,8 @@
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from odoo import api, fields, models
+from odoo import _, api, fields, models
+from odoo.exceptions import UserError
class WorkAcceptance(models.Model):
@@ -112,6 +113,15 @@ def button_accept(self, force=False):
self.write({"state": "accept", "date_accept": fields.Datetime.now()})
def button_draft(self):
+ picking_obj = self.env["stock.picking"]
+ wa_ids = picking_obj.search([("wa_id", "in", self.ids)])
+ if wa_ids:
+ raise UserError(
+ _(
+ "Unable set to draft this work acceptance. "
+ "You must first cancel the related receipts."
+ )
+ )
self.write({"state": "draft"})
def button_cancel(self):
diff --git a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
index f7edd17b456..61b4a8dd818 100644
--- a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
+++ b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
@@ -2,55 +2,47 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields
-from odoo.exceptions import ValidationError
+from odoo.exceptions import UserError, ValidationError
from odoo.tests.common import Form, TransactionCase
class TestPurchaseWorkAcceptance(TransactionCase):
def setUp(self):
- super(TestPurchaseWorkAcceptance, self).setUp()
- # Create Product
+ super().setUp()
self.service_product = self.env.ref("product.product_product_1")
self.product_product = self.env.ref("product.product_product_6")
- # Create Vendor
self.res_partner = self.env.ref("base.res_partner_3")
- # Create Employee
self.employee = self.env.ref("base.user_demo")
- # Create Date
+ self.main_company = self.env.ref("base.main_company")
self.date_now = fields.Datetime.now()
+ # Enable and Config WA
+ self.env["res.config.settings"].create(
+ {"group_enable_wa_on_po": True}
+ ).execute()
- def test_00_wa_button(self):
- work_acceptance = self.env["work.acceptance"].create(
+ def _create_purchase_order(self, qty):
+ purchase_order = self.env["purchase.order"].create(
{
"partner_id": self.res_partner.id,
- "responsible_id": self.employee.id,
- "date_due": self.date_now,
- "date_receive": self.date_now,
- "company_id": self.env.ref("base.main_company").id,
- "wa_line_ids": [
+ "order_line": [
(
0,
0,
{
- "product_id": self.service_product.id,
- "name": self.service_product.name,
- "price_unit": self.service_product.standard_price,
- "product_qty": 3.0,
- "product_uom": self.service_product.uom_id.id,
+ "product_id": self.product_product.id,
+ "product_uom": self.product_product.uom_id.id,
+ "name": self.product_product.name,
+ "price_unit": self.product_product.standard_price,
+ "date_planned": self.date_now,
+ "product_qty": qty,
},
)
],
}
)
- work_acceptance.button_accept()
- self.assertEqual(work_acceptance.state, "accept")
- work_acceptance.button_cancel()
- self.assertEqual(work_acceptance.state, "cancel")
- work_acceptance.button_draft()
- self.assertEqual(work_acceptance.state, "draft")
+ return purchase_order
- def test_01_action_view_wa(self):
- # Create Purchase Order
+ def _create_multi_purchase_order(self, qty, multi):
purchase_order = self.env["purchase.order"].create(
{
"partner_id": self.res_partner.id,
@@ -59,50 +51,56 @@ def test_01_action_view_wa(self):
0,
0,
{
- "product_id": self.service_product.id,
- "product_uom": self.service_product.uom_id.id,
- "name": self.service_product.name,
- "price_unit": self.service_product.standard_price,
+ "product_id": self.product_product.id,
+ "product_uom": self.product_product.uom_id.id,
+ "name": self.product_product.name,
+ "price_unit": self.product_product.standard_price,
"date_planned": self.date_now,
- "product_qty": 42.0,
+ "product_qty": qty,
},
)
+ for x in range(multi)
],
}
)
- purchase_order.button_confirm()
- self.assertEqual(purchase_order.state, "purchase")
-
- res = purchase_order.with_context(create_wa=True).action_view_wa()
- ctx = res.get("context")
- work_acceptance = Form(self.env["work.acceptance"].with_context(ctx))
- self.assertEqual(work_acceptance.state, "draft")
+ return purchase_order
- def test_02_flow_product(self):
- # Create Purchase Order
- purchase_order = self.env["purchase.order"].create(
+ def _create_work_acceptance(self, qty, po=False):
+ work_acceptance = self.env["work.acceptance"].create(
{
+ "purchase_id": po and po.id or False,
"partner_id": self.res_partner.id,
- "order_line": [
+ "responsible_id": self.employee.id,
+ "date_due": self.date_now,
+ "date_receive": self.date_now,
+ "company_id": self.main_company.id,
+ "wa_line_ids": [
(
0,
0,
{
- "product_id": self.product_product.id,
- "product_uom": self.product_product.uom_id.id,
- "name": self.product_product.name,
- "price_unit": self.product_product.standard_price,
- "date_planned": self.date_now,
- "product_qty": 42.0,
+ "purchase_line_id": po and po.order_line[0].id or False,
+ "product_id": po
+ and po.order_line[0].product_id.id
+ or self.service_product.id,
+ "name": po
+ and po.order_line[0].name
+ or self.service_product.name,
+ "price_unit": po
+ and po.order_line[0].price_unit
+ or self.service_product.standard_price,
+ "product_uom": po
+ and po.order_line[0].product_uom.id
+ or self.service_product.uom_id.id,
+ "product_qty": qty,
},
)
],
}
)
- purchase_order.button_confirm()
- self.assertEqual(purchase_order.state, "purchase")
- self.assertEqual(purchase_order.picking_count, 1)
- # Create Work Acceptance
+ return work_acceptance
+
+ def _create_multi_work_acceptance(self, qty, purchase_order, multi):
work_acceptance = self.env["work.acceptance"].create(
{
"purchase_id": purchase_order.id,
@@ -110,37 +108,74 @@ def test_02_flow_product(self):
"responsible_id": self.employee.id,
"date_due": self.date_now,
"date_receive": self.date_now,
- "company_id": self.env.ref("base.main_company").id,
+ "company_id": self.main_company.id,
"wa_line_ids": [
(
0,
0,
{
- "purchase_line_id": purchase_order.order_line[0].id,
- "product_id": purchase_order.order_line[0].product_id.id,
- "name": purchase_order.order_line[0].name,
- "price_unit": purchase_order.order_line[0].price_unit,
- "product_uom": purchase_order.order_line[0].product_uom.id,
- "product_qty": 42.0,
+ "purchase_line_id": purchase_order.order_line[x].id,
+ "product_id": purchase_order.order_line[x].product_id.id,
+ "name": purchase_order.order_line[x].name,
+ "price_unit": purchase_order.order_line[x].price_unit,
+ "product_uom": purchase_order.order_line[x].product_uom.id,
+ "product_qty": qty,
},
)
+ for x in range(multi)
],
}
)
+ return work_acceptance
+
+ def test_00_wa_button(self):
+ qty = 3.0
+ work_acceptance = self._create_work_acceptance(qty)
+ work_acceptance.button_accept()
+ self.assertEqual(work_acceptance.state, "accept")
+ work_acceptance.button_cancel()
+ self.assertEqual(work_acceptance.state, "cancel")
+ work_acceptance.button_draft()
+ self.assertEqual(work_acceptance.state, "draft")
+
+ def test_01_action_view_wa(self):
+ # Create Purchase Order
+ qty = 42.0
+ purchase_order = self._create_purchase_order(qty)
+ purchase_order.button_confirm()
+ self.assertEqual(purchase_order.state, "purchase")
+
+ res = purchase_order.with_context(create_wa=True).action_view_wa()
+ ctx = res.get("context")
+ work_acceptance = Form(self.env["work.acceptance"].with_context(ctx))
+ self.assertEqual(work_acceptance.state, "draft")
+
+ def test_02_flow_product(self):
+ # Create Purchase Order
+ qty = 42.0
+ purchase_order = self._create_purchase_order(qty)
+ purchase_order.button_confirm()
+ self.assertEqual(purchase_order.state, "purchase")
+ self.assertEqual(purchase_order.picking_count, 1)
+ # Create Work Acceptance
+ work_acceptance = self._create_work_acceptance(qty, purchase_order)
work_acceptance.button_accept()
self.assertEqual(work_acceptance.state, "accept")
self.assertEqual(purchase_order.wa_count, 1)
# Received Products
picking = purchase_order.picking_ids[0]
self.assertEqual(len(picking.move_ids_without_package), 1)
- picking.wa_id = work_acceptance
- picking._onchange_wa_id()
-
+ with Form(picking) as p:
+ p.wa_id = work_acceptance
+ p.save()
with self.assertRaises(ValidationError):
picking.move_ids_without_package[0].quantity_done = 30.0
picking.button_validate()
picking.move_ids_without_package[0].quantity_done = 42.0
picking.button_validate()
+ # Can't set to draft wa when you validate picking
+ with self.assertRaises(UserError):
+ work_acceptance.button_draft()
# Create Vendor Bill
f = Form(self.env["account.move"].with_context(default_type="in_invoice"))
f.partner_id = purchase_order.partner_id
@@ -158,66 +193,80 @@ def test_02_flow_product(self):
invoice.action_post()
def test_03_flow_service(self):
+ qty = 30.0
# Create Purchase Order
- purchase_order = self.env["purchase.order"].create(
- {
- "partner_id": self.res_partner.id,
- "order_line": [
- (
- 0,
- 0,
- {
- "product_id": self.service_product.id,
- "product_uom": self.service_product.uom_id.id,
- "name": self.service_product.name,
- "price_unit": self.service_product.standard_price,
- "date_planned": self.date_now,
- "product_qty": 30.0,
- },
- )
- ],
- }
- )
+ purchase_order = self._create_purchase_order(qty)
purchase_order.button_confirm()
self.assertEqual(purchase_order.state, "purchase")
# Create Work Acceptance
- work_acceptance = self.env["work.acceptance"].create(
- {
- "purchase_id": purchase_order.id,
- "partner_id": self.res_partner.id,
- "responsible_id": self.employee.id,
- "date_due": self.date_now,
- "date_receive": self.date_now,
- "company_id": self.env.ref("base.main_company").id,
- "wa_line_ids": [
- (
- 0,
- 0,
- {
- "purchase_line_id": purchase_order.order_line[0].id,
- "product_id": purchase_order.order_line[0].product_id.id,
- "name": purchase_order.order_line[0].name,
- "price_unit": purchase_order.order_line[0].price_unit,
- "product_uom": purchase_order.order_line[0].product_uom.id,
- "product_qty": 30.0,
- },
- )
- ],
- }
- )
+ work_acceptance = self._create_work_acceptance(qty, purchase_order)
work_acceptance.button_accept()
self.assertEqual(work_acceptance.state, "accept")
self.assertEqual(purchase_order.wa_count, 1)
# Create Vendor Bill
- purchase_order.with_context(create_bill=True).action_view_invoice()
- wizard = self.env["select.work.acceptance.wizard"].create(
- {"wa_id": work_acceptance.id}
+ res = purchase_order.with_context(create_bill=True).action_view_invoice()
+ ctx = res.get("context")
+ f = Form(
+ self.env["account.move"].with_context(ctx), view="account.view_move_form"
)
- wiz = wizard.button_create_vendor_bill()
- f = Form(self.env["account.move"].with_context(wiz.get("context", {})))
- f.purchase_id = purchase_order
invoice = f.save()
- invoice._onchange_purchase_auto_complete()
self.assertEqual(invoice.state, "draft")
invoice.action_post()
self.assertEqual(invoice.state, "posted")
+
+ def test_04_enable_config_flow(self):
+ qty = 2.0
+ # Create Purchase Order
+ purchase_order = self._create_purchase_order(qty)
+ purchase_order.button_confirm()
+ # Create Work Acceptance
+ work_acceptance = self._create_work_acceptance(qty, purchase_order)
+ work_acceptance.button_accept()
+ res = purchase_order.with_context(create_bill=True).action_view_invoice()
+ self.assertEqual(res.get("res_model"), "account.move")
+ # enable wa on invoice
+ self.env["res.config.settings"].create(
+ {"group_enable_wa_on_invoice": True}
+ ).execute()
+ res = purchase_order.with_context(create_bill=True).action_view_invoice()
+ self.assertEqual(res.get("res_model"), "select.work.acceptance.wizard")
+ wizard = self.env[res.get("res_model")].create({"wa_id": work_acceptance.id})
+ wiz = wizard.button_create_vendor_bill()
+ ctx = wiz.get("context")
+ f = Form(
+ self.env["account.move"].with_context(ctx), view="account.view_move_form"
+ )
+ f.save()
+
+ def test_05_create_multi_lines(self):
+ qty = 5.0
+ # Create Purchase Order
+ purchase_order = self._create_multi_purchase_order(qty, multi=2)
+ purchase_order.button_confirm()
+ # Create Work Acceptance
+ work_acceptance = work_acceptance = self._create_multi_work_acceptance(
+ qty, purchase_order, multi=2
+ )
+ work_acceptance.button_accept()
+ # Received Products
+ picking = purchase_order.picking_ids[0]
+ self.assertEqual(len(picking.move_ids_without_package), 2)
+ with Form(picking) as p:
+ p.wa_id = work_acceptance
+ p.save()
+ picking.button_validate()
+ # Create Vendor Bill
+ self.env["res.config.settings"].create(
+ {"group_enable_wa_on_invoice": True}
+ ).execute()
+ res = purchase_order.with_context(create_bill=True).action_view_invoice()
+ self.assertEqual(res.get("res_model"), "select.work.acceptance.wizard")
+ wizard = self.env[res.get("res_model")].create({"wa_id": work_acceptance.id})
+ wiz = wizard.button_create_vendor_bill()
+ ctx = wiz.get("context")
+ f = Form(
+ self.env["account.move"].with_context(ctx), view="account.view_move_form"
+ )
+ invoice = f.save()
+ with self.assertRaises(ValidationError):
+ invoice.action_post()
diff --git a/purchase_work_acceptance/views/account_move_views.xml b/purchase_work_acceptance/views/account_move_views.xml
index 6e520e37761..3674b903774 100644
--- a/purchase_work_acceptance/views/account_move_views.xml
+++ b/purchase_work_acceptance/views/account_move_views.xml
@@ -11,9 +11,7 @@
name="wa_id"
options="{'no_create': True}"
groups="purchase_work_acceptance.group_enable_wa_on_invoice"
- attrs="{'required': [('require_wa','=', True)],
- 'readonly': True,
- 'invisible': ['|', ('wa_id', '=', False), ('purchase_id', '=', False)]}"
+ attrs="{'required': [('require_wa','=', True)], 'invisible': [('wa_id', '=', False)]}"
/>
From 83731aa1fff42b3b847ecc4df73338acc2f81998 Mon Sep 17 00:00:00 2001
From: oca-travis
Date: Thu, 10 Sep 2020 14:22:10 +0000
Subject: [PATCH 012/210] [UPD] Update purchase_work_acceptance.pot
---
.../i18n/purchase_work_acceptance.pot | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
index 87c96e59491..53131e37e84 100644
--- a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
+++ b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
@@ -504,6 +504,14 @@ msgstr ""
msgid "Type of the exception activity on record."
msgstr ""
+#. module: purchase_work_acceptance
+#: code:addons/purchase_work_acceptance/models/work_acceptance.py:0
+#, python-format
+msgid ""
+"Unable set to draft this work acceptance. You must first cancel the related "
+"receipts."
+msgstr ""
+
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__price_unit
msgid "Unit Price"
From ca2bdf4b66ffdc3c63d866ab3871c62ec9326f3d Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Thu, 10 Sep 2020 14:44:52 +0000
Subject: [PATCH 013/210] purchase_work_acceptance 13.0.1.1.0
---
purchase_work_acceptance/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index 2db6e9592f7..5d1d164ae6e 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Work Acceptance",
- "version": "13.0.1.0.2",
+ "version": "13.0.1.1.0",
"category": "Purchase Management",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
From 93aae3d141fb96dd94d29e7604878ba54b57a9c9 Mon Sep 17 00:00:00 2001
From: oca-travis
Date: Mon, 5 Oct 2020 10:13:05 +0000
Subject: [PATCH 014/210] [UPD] Update purchase_work_acceptance.pot
---
.../i18n/purchase_work_acceptance.pot | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
index 53131e37e84..45249acb396 100644
--- a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
+++ b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
@@ -98,11 +98,6 @@ msgstr ""
msgid "Company"
msgstr ""
-#. module: purchase_work_acceptance
-#: model:ir.model,name:purchase_work_acceptance.model_res_config_settings
-msgid "Config Settings"
-msgstr ""
-
#. module: purchase_work_acceptance
#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_select_work_acceptance_wizard
msgid "Create Vendor Bill"
@@ -368,6 +363,11 @@ msgstr ""
msgid "Portal Access URL"
msgstr ""
+#. module: purchase_work_acceptance
+#: model:ir.model,name:purchase_work_acceptance.model_res_config_settings
+msgid "Procurement purchase grouping settings"
+msgstr ""
+
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__product_id
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__product_id
From 5640ba9a4cc8cdd1c965f3a8da173b6098e6beea Mon Sep 17 00:00:00 2001
From: ps-tubtim
Date: Tue, 3 Nov 2020 11:06:30 +0700
Subject: [PATCH 015/210] [IMP] purchase_work_acceptance: black, isort,
prettier
---
purchase_work_acceptance/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index 5d1d164ae6e..ab0216feb72 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Work Acceptance",
- "version": "13.0.1.1.0",
+ "version": "14.0.1.0.0",
"category": "Purchase Management",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
From 9290c1c915e6e111ed1234b43983a9bec893d59d Mon Sep 17 00:00:00 2001
From: ps-tubtim
Date: Tue, 3 Nov 2020 12:42:23 +0700
Subject: [PATCH 016/210] [MIG] purchase_work_acceptance: Migration to 14.0
---
purchase_work_acceptance/models/purchase.py | 8 ++--
.../models/work_acceptance.py | 12 +++---
.../security/ir.model.access.csv | 1 +
.../tests/test_purchase_work_acceptance.py | 40 ++++++++++---------
.../views/purchase_views.xml | 8 ++--
.../views/work_acceptance_views.xml | 14 ++++---
.../wizard/select_work_acceptance_wizard.py | 7 +++-
7 files changed, 50 insertions(+), 40 deletions(-)
diff --git a/purchase_work_acceptance/models/purchase.py b/purchase_work_acceptance/models/purchase.py
index 86598c517e6..2e80e5d085f 100644
--- a/purchase_work_acceptance/models/purchase.py
+++ b/purchase_work_acceptance/models/purchase.py
@@ -66,7 +66,7 @@ def action_view_wa(self):
result["res_id"] = self.wa_ids.id or False
return result
- def action_view_invoice(self):
+ def action_create_invoice(self):
if self.env.context.get("create_bill", False) and self.env.user.has_group(
"purchase_work_acceptance.group_enable_wa_on_invoice"
):
@@ -82,7 +82,7 @@ def action_view_invoice(self):
"view_id": wizard.id,
"target": "new",
}
- return super().action_view_invoice()
+ return super().action_create_invoice()
class PurchaseOrderLine(models.Model):
@@ -102,9 +102,9 @@ def _get_product_qty(self):
if wa_line.wa_id.state != "cancel"
)
- def _prepare_account_move_line(self, move):
+ def _prepare_account_move_line(self, move=False):
res = super()._prepare_account_move_line(move)
- if move.wa_id:
+ if move and move.wa_id:
wa_line = self.wa_line_ids.filtered(lambda l: l.wa_id == move.wa_id)
res["quantity"] = wa_line.product_qty
res["product_uom_id"] = wa_line.product_uom
diff --git a/purchase_work_acceptance/models/work_acceptance.py b/purchase_work_acceptance/models/work_acceptance.py
index 2f03a6cb15d..7b1ee8b84a2 100644
--- a/purchase_work_acceptance/models/work_acceptance.py
+++ b/purchase_work_acceptance/models/work_acceptance.py
@@ -32,7 +32,7 @@ class WorkAcceptance(models.Model):
string="Vendor",
required=True,
change_default=True,
- track_visibility="always",
+ tracking=True,
readonly=True,
states={"draft": [("readonly", False)]},
)
@@ -42,14 +42,14 @@ class WorkAcceptance(models.Model):
default=lambda self: self.env.user,
required=True,
change_default=True,
- track_visibility="always",
+ tracking=True,
readonly=True,
states={"draft": [("readonly", False)]},
)
currency_id = fields.Many2one(
comodel_name="res.currency",
string="Currency",
- default=lambda self: self.env.user.company_id.currency_id.id,
+ default=lambda self: self.env.company.currency_id,
required=True,
readonly=True,
)
@@ -60,7 +60,7 @@ class WorkAcceptance(models.Model):
index=True,
copy=False,
default="draft",
- track_visibility="onchange",
+ tracking=True,
)
wa_line_ids = fields.One2many(
comodel_name="work.acceptance.line",
@@ -79,12 +79,12 @@ class WorkAcceptance(models.Model):
string="Work Acceptance Representative",
default=lambda self: self.env.user,
index=True,
- track_visibility="onchange",
+ tracking=True,
)
company_id = fields.Many2one(
comodel_name="res.company",
string="Company",
- default=lambda self: self.env.company.id,
+ default=lambda self: self.env.company,
required=True,
index=True,
readonly=True,
diff --git a/purchase_work_acceptance/security/ir.model.access.csv b/purchase_work_acceptance/security/ir.model.access.csv
index 8a600c6e5a5..c5e4734f292 100644
--- a/purchase_work_acceptance/security/ir.model.access.csv
+++ b/purchase_work_acceptance/security/ir.model.access.csv
@@ -1,3 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_work_acceptance,access_work_acceptance,model_work_acceptance,purchase.group_purchase_user,1,1,1,1
access_work_acceptance_line,access_work_acceptance_line,model_work_acceptance_line,purchase.group_purchase_user,1,1,1,1
+access_select_work_acceptance_wizard,access_select_work_acceptance_wizard,model_select_work_acceptance_wizard,purchase.group_purchase_user,1,1,1,1
diff --git a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
index 61b4a8dd818..682bf9c2d4b 100644
--- a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
+++ b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
@@ -20,7 +20,7 @@ def setUp(self):
{"group_enable_wa_on_po": True}
).execute()
- def _create_purchase_order(self, qty):
+ def _create_purchase_order(self, qty, product):
purchase_order = self.env["purchase.order"].create(
{
"partner_id": self.res_partner.id,
@@ -29,10 +29,10 @@ def _create_purchase_order(self, qty):
0,
0,
{
- "product_id": self.product_product.id,
- "product_uom": self.product_product.uom_id.id,
- "name": self.product_product.name,
- "price_unit": self.product_product.standard_price,
+ "product_id": product.id,
+ "product_uom": product.uom_id.id,
+ "name": product.name,
+ "price_unit": product.standard_price,
"date_planned": self.date_now,
"product_qty": qty,
},
@@ -141,7 +141,7 @@ def test_00_wa_button(self):
def test_01_action_view_wa(self):
# Create Purchase Order
qty = 42.0
- purchase_order = self._create_purchase_order(qty)
+ purchase_order = self._create_purchase_order(qty, self.product_product)
purchase_order.button_confirm()
self.assertEqual(purchase_order.state, "purchase")
@@ -153,7 +153,7 @@ def test_01_action_view_wa(self):
def test_02_flow_product(self):
# Create Purchase Order
qty = 42.0
- purchase_order = self._create_purchase_order(qty)
+ purchase_order = self._create_purchase_order(qty, self.product_product)
purchase_order.button_confirm()
self.assertEqual(purchase_order.state, "purchase")
self.assertEqual(purchase_order.picking_count, 1)
@@ -177,7 +177,7 @@ def test_02_flow_product(self):
with self.assertRaises(UserError):
work_acceptance.button_draft()
# Create Vendor Bill
- f = Form(self.env["account.move"].with_context(default_type="in_invoice"))
+ f = Form(self.env["account.move"].with_context(default_move_type="in_invoice"))
f.partner_id = purchase_order.partner_id
f.purchase_id = purchase_order
# f.wa_id = work_acceptance
@@ -189,13 +189,15 @@ def test_02_flow_product(self):
{"quantity": 6.0}
)
invoice.action_post() # Warn when quantity not equal to WA
- invoice_line.quantity = 42.0
+ invoice_line.quantity = qty
+ self.assertEqual(invoice.state, "draft")
invoice.action_post()
+ self.assertEqual(invoice.state, "posted")
def test_03_flow_service(self):
qty = 30.0
# Create Purchase Order
- purchase_order = self._create_purchase_order(qty)
+ purchase_order = self._create_purchase_order(qty, self.service_product)
purchase_order.button_confirm()
self.assertEqual(purchase_order.state, "purchase")
# Create Work Acceptance
@@ -204,12 +206,12 @@ def test_03_flow_service(self):
self.assertEqual(work_acceptance.state, "accept")
self.assertEqual(purchase_order.wa_count, 1)
# Create Vendor Bill
- res = purchase_order.with_context(create_bill=True).action_view_invoice()
- ctx = res.get("context")
- f = Form(
- self.env["account.move"].with_context(ctx), view="account.view_move_form"
- )
+ f = Form(self.env["account.move"].with_context(default_move_type="in_invoice"))
+ f.partner_id = purchase_order.partner_id
+ f.purchase_id = purchase_order
+ # f.wa_id = work_acceptance
invoice = f.save()
+ invoice.wa_id = work_acceptance
self.assertEqual(invoice.state, "draft")
invoice.action_post()
self.assertEqual(invoice.state, "posted")
@@ -217,18 +219,18 @@ def test_03_flow_service(self):
def test_04_enable_config_flow(self):
qty = 2.0
# Create Purchase Order
- purchase_order = self._create_purchase_order(qty)
+ purchase_order = self._create_purchase_order(qty, self.service_product)
purchase_order.button_confirm()
# Create Work Acceptance
work_acceptance = self._create_work_acceptance(qty, purchase_order)
work_acceptance.button_accept()
- res = purchase_order.with_context(create_bill=True).action_view_invoice()
+ res = purchase_order.with_context(create_bill=True).action_create_invoice()
self.assertEqual(res.get("res_model"), "account.move")
# enable wa on invoice
self.env["res.config.settings"].create(
{"group_enable_wa_on_invoice": True}
).execute()
- res = purchase_order.with_context(create_bill=True).action_view_invoice()
+ res = purchase_order.with_context(create_bill=True).action_create_invoice()
self.assertEqual(res.get("res_model"), "select.work.acceptance.wizard")
wizard = self.env[res.get("res_model")].create({"wa_id": work_acceptance.id})
wiz = wizard.button_create_vendor_bill()
@@ -259,7 +261,7 @@ def test_05_create_multi_lines(self):
self.env["res.config.settings"].create(
{"group_enable_wa_on_invoice": True}
).execute()
- res = purchase_order.with_context(create_bill=True).action_view_invoice()
+ res = purchase_order.with_context(create_bill=True).action_create_invoice()
self.assertEqual(res.get("res_model"), "select.work.acceptance.wizard")
wizard = self.env[res.get("res_model")].create({"wa_id": work_acceptance.id})
wiz = wizard.button_create_vendor_bill()
diff --git a/purchase_work_acceptance/views/purchase_views.xml b/purchase_work_acceptance/views/purchase_views.xml
index 1b0b8afca4d..c8507149522 100644
--- a/purchase_work_acceptance/views/purchase_views.xml
+++ b/purchase_work_acceptance/views/purchase_views.xml
@@ -35,9 +35,11 @@
expr="//field[@name='order_line']/tree//field[@name='qty_received']"
position="attributes"
>
- {'column_invisible': [('parent.state', 'not in', ('purchase', 'done'))], 'readonly': ['|', ('product_type', 'in', ('consu', 'product')), ('wa_line_ids', '!=', ())]}
+
+ {'column_invisible': [('parent.state', 'not in', ('purchase',
+ 'done'))], 'readonly': ['|', ('product_type', 'in', ('consu',
+ 'product')), ('wa_line_ids', '!=', ())]}
+
diff --git a/purchase_work_acceptance/views/work_acceptance_views.xml b/purchase_work_acceptance/views/work_acceptance_views.xml
index c137b6b5d59..fce1f00dd08 100644
--- a/purchase_work_acceptance/views/work_acceptance_views.xml
+++ b/purchase_work_acceptance/views/work_acceptance_views.xml
@@ -29,13 +29,13 @@
name="state"
widget="statusbar"
statusbar_visible="draft,accept"
- readonly="1"
+ attrs="{'readonly': True}"
/>
-
+
@@ -140,7 +140,11 @@
groups="base.group_multi_company"
options="{'no_create': True}"
/>
-
+
@@ -214,9 +218,7 @@
-
- Create a new work acceptance
-
+ Create a new work acceptance
Date: Wed, 2 Dec 2020 10:02:53 +0000
Subject: [PATCH 017/210] [UPD] Update purchase_work_acceptance.pot
---
.../i18n/purchase_work_acceptance.pot | 45 ++++++++++++++++---
1 file changed, 38 insertions(+), 7 deletions(-)
diff --git a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
index 45249acb396..4949eecde55 100644
--- a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
+++ b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 13.0\n"
+"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -77,6 +77,11 @@ msgstr ""
msgid "Activity State"
msgstr ""
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__activity_type_icon
+msgid "Activity Type Icon"
+msgstr ""
+
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_attachment_count
msgid "Attachment Count"
@@ -98,6 +103,11 @@ msgstr ""
msgid "Company"
msgstr ""
+#. module: purchase_work_acceptance
+#: model:ir.model,name:purchase_work_acceptance.model_res_config_settings
+msgid "Config Settings"
+msgstr ""
+
#. module: purchase_work_acceptance
#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_select_work_acceptance_wizard
msgid "Create Vendor Bill"
@@ -149,7 +159,12 @@ msgid "Description"
msgstr ""
#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_move__display_name
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order__display_name
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order_line__display_name
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_res_config_settings__display_name
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard__display_name
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_stock_picking__display_name
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__display_name
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__display_name
msgid "Display Name"
@@ -213,13 +228,23 @@ msgstr ""
msgid "Followers (Partners)"
msgstr ""
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,help:purchase_work_acceptance.field_work_acceptance__activity_type_icon
+msgid "Font awesome icon e.g. fa-tasks"
+msgstr ""
+
#. module: purchase_work_acceptance
#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
msgid "Group By"
msgstr ""
#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_move__id
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order__id
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order_line__id
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_res_config_settings__id
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard__id
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_stock_picking__id
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__id
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__id
msgid "ID"
@@ -259,11 +284,16 @@ msgstr ""
#. module: purchase_work_acceptance
#: model:ir.model,name:purchase_work_acceptance.model_account_move
-msgid "Journal Entries"
+msgid "Journal Entry"
msgstr ""
#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_move____last_update
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order____last_update
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order_line____last_update
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_res_config_settings____last_update
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard____last_update
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_stock_picking____last_update
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance____last_update
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line____last_update
msgid "Last Modified on"
@@ -363,11 +393,6 @@ msgstr ""
msgid "Portal Access URL"
msgstr ""
-#. module: purchase_work_acceptance
-#: model:ir.model,name:purchase_work_acceptance.model_res_config_settings
-msgid "Procurement purchase grouping settings"
-msgstr ""
-
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__product_id
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__product_id
@@ -419,7 +444,9 @@ msgid "Reference"
msgstr ""
#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_bank_statement_line__require_wa
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_move__require_wa
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_payment__require_wa
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard__require_wa
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_stock_picking__require_wa
msgid "Require Wa"
@@ -483,7 +510,9 @@ msgid "Subtotal"
msgstr ""
#. module: purchase_work_acceptance
+#: model:ir.model.fields,help:purchase_work_acceptance.field_account_bank_statement_line__wa_id
#: model:ir.model.fields,help:purchase_work_acceptance.field_account_move__wa_id
+#: model:ir.model.fields,help:purchase_work_acceptance.field_account_payment__wa_id
msgid ""
"To control quantity and unit price of the vendor bill, to be according to "
"the quantity and unit price of the work acceptance."
@@ -545,7 +574,9 @@ msgid "WA Lines"
msgstr ""
#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_bank_statement_line__wa_id
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_move__wa_id
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_payment__wa_id
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_stock_picking__wa_id
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__wa_id
msgid "WA Reference"
From 7ad883d0ade6cb9c2b1e453a2386fc9cb5d0c821 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Wed, 2 Dec 2020 10:39:57 +0000
Subject: [PATCH 018/210] [UPD] README.rst
---
purchase_work_acceptance/README.rst | 10 +++++-----
purchase_work_acceptance/static/description/index.html | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/purchase_work_acceptance/README.rst b/purchase_work_acceptance/README.rst
index 60d9c8d3d60..3d3ab180449 100644
--- a/purchase_work_acceptance/README.rst
+++ b/purchase_work_acceptance/README.rst
@@ -14,13 +14,13 @@ Purchase Work Acceptance
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
- :target: https://github.com/OCA/purchase-workflow/tree/13.0/purchase_work_acceptance
+ :target: https://github.com/OCA/purchase-workflow/tree/14.0/purchase_work_acceptance
:alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/purchase-workflow-13-0/purchase-workflow-13-0-purchase_work_acceptance
+ :target: https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_work_acceptance
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/142/13.0
+ :target: https://runbot.odoo-community.org/runbot/142/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -109,7 +109,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -141,6 +141,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-This module is part of the `OCA/purchase-workflow `_ project on GitHub.
+This module is part of the `OCA/purchase-workflow `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/purchase_work_acceptance/static/description/index.html b/purchase_work_acceptance/static/description/index.html
index 52e1029c188..48869057456 100644
--- a/purchase_work_acceptance/static/description/index.html
+++ b/purchase_work_acceptance/static/description/index.html
@@ -367,7 +367,7 @@ Purchase Work Acceptance
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
This module introduces the ability to define a quantity control point on Receipts and Vendor Bills by
Work Acceptance. Only the products and services that have been included in a Work Acceptance can be
received and/or invoiced.
@@ -460,7 +460,7 @@
Bugs are tracked on GitHub Issues .
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback .
+feedback .
Do not contact contributors directly about support or help with technical issues.
@@ -487,7 +487,7 @@
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-
This module is part of the OCA/purchase-workflow project on GitHub.
+
This module is part of the OCA/purchase-workflow project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute .
From 51abd93c01aabb6ed165ba37b595301df7897d03 Mon Sep 17 00:00:00 2001
From: Prapassorn Sornkaew
Date: Tue, 19 Jan 2021 13:45:34 +0000
Subject: [PATCH 019/210] [FIX] purchase_work_acceptance: field WA Reference
inconsistent between invisible and required.
---
purchase_work_acceptance/models/stock_picking.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/purchase_work_acceptance/models/stock_picking.py b/purchase_work_acceptance/models/stock_picking.py
index 381db94fe05..ed5cb556789 100644
--- a/purchase_work_acceptance/models/stock_picking.py
+++ b/purchase_work_acceptance/models/stock_picking.py
@@ -20,9 +20,12 @@ class Picking(models.Model):
)
def _compute_require_wa(self):
- self.require_wa = self.env.user.has_group(
- "purchase_work_acceptance.group_enforce_wa_on_in"
- )
+ if self.picking_type_code == "incoming":
+ self.require_wa = self.env.user.has_group(
+ "purchase_work_acceptance.group_enforce_wa_on_in"
+ )
+ else:
+ self.require_wa = False
def button_validate(self):
if self.wa_id:
From ea889631f4cbd462ad385270146e1f041ab7e070 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Wed, 20 Jan 2021 01:27:59 +0000
Subject: [PATCH 020/210] purchase_work_acceptance 14.0.1.0.1
---
purchase_work_acceptance/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index ab0216feb72..09e3cf8514a 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Work Acceptance",
- "version": "14.0.1.0.0",
+ "version": "14.0.1.0.1",
"category": "Purchase Management",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
From b55232e5f2c9f6e95617e42b87ac806079818d78 Mon Sep 17 00:00:00 2001
From: Surachet Saejueng
Date: Thu, 21 Jan 2021 07:59:44 +0000
Subject: [PATCH 021/210] [IMP] purchase_work_acceptance: show accepted qty and
show button create wa when available
---
purchase_work_acceptance/models/purchase.py | 44 ++++++++++++++++++-
.../tests/test_purchase_work_acceptance.py | 23 ++++++++++
.../views/purchase_views.xml | 23 ++++++++--
3 files changed, 86 insertions(+), 4 deletions(-)
diff --git a/purchase_work_acceptance/models/purchase.py b/purchase_work_acceptance/models/purchase.py
index 2e80e5d085f..084740d1a16 100644
--- a/purchase_work_acceptance/models/purchase.py
+++ b/purchase_work_acceptance/models/purchase.py
@@ -1,7 +1,7 @@
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from odoo import _, fields, models
+from odoo import _, api, fields, models
class PurchaseOrder(models.Model):
@@ -19,6 +19,7 @@ class PurchaseOrder(models.Model):
string="WA Lines",
readonly=True,
)
+ wa_accepted = fields.Boolean(string="WA Accepted", compute="_compute_wa_accepted")
def _compute_wa_ids(self):
for order in self:
@@ -84,6 +85,11 @@ def action_create_invoice(self):
}
return super().action_create_invoice()
+ def _compute_wa_accepted(self):
+ for order in self:
+ lines = order.order_line.filtered(lambda l: l.qty_to_accept > 0)
+ order.wa_accepted = not any(lines)
+
class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"
@@ -94,6 +100,20 @@ class PurchaseOrderLine(models.Model):
string="WA Lines",
readonly=True,
)
+ qty_accepted = fields.Float(
+ compute="_compute_qty_accepted",
+ string="Accepted Qty.",
+ store=True,
+ readonly=True,
+ digits="Product Unit of Measure",
+ )
+ qty_to_accept = fields.Float(
+ compute="_compute_qty_accepted",
+ string="To Accept Qty.",
+ store=True,
+ readonly=True,
+ digits="Product Unit of Measure",
+ )
def _get_product_qty(self):
return self.product_qty - sum(
@@ -109,3 +129,25 @@ def _prepare_account_move_line(self, move=False):
res["quantity"] = wa_line.product_qty
res["product_uom_id"] = wa_line.product_uom
return res
+
+ @api.depends(
+ "wa_line_ids.wa_id.state",
+ "wa_line_ids.product_qty",
+ "product_qty",
+ "product_uom_qty",
+ "order_id.state",
+ )
+ def _compute_qty_accepted(self):
+ for line in self:
+ # compute qty_accepted
+ qty = 0.0
+ for wa_line in line.wa_line_ids.filtered(
+ lambda l: l.wa_id.state == "accept"
+ ):
+ qty += wa_line.product_uom._compute_quantity(
+ wa_line.product_qty, line.product_uom
+ )
+ line.qty_accepted = qty
+
+ # compute qty_to_accept
+ line.qty_to_accept = line.product_uom_qty - line.qty_accepted
diff --git a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
index 682bf9c2d4b..e064ad8bc26 100644
--- a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
+++ b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
@@ -272,3 +272,26 @@ def test_05_create_multi_lines(self):
invoice = f.save()
with self.assertRaises(ValidationError):
invoice.action_post()
+
+ def test_06_check_qty_accepted(self):
+ qty_po = 20.0
+ qty_wa = 12.0
+ purchase_order = self._create_purchase_order(qty_po, self.product_product)
+ purchase_order.button_confirm()
+ work_acceptance = self._create_work_acceptance(qty_wa, po=purchase_order)
+ work_acceptance.button_accept()
+ self.assertEqual(purchase_order.order_line[0].qty_accepted, 12.0)
+ self.assertEqual(purchase_order.order_line[0].qty_to_accept, 8.0)
+
+ def test_07_hide_wa_button(self):
+ qty_po = 20.0
+ purchase_order = self._create_purchase_order(qty_po, self.product_product)
+ purchase_order.button_confirm()
+ work_acceptance = self._create_work_acceptance(qty=12, po=purchase_order)
+ work_acceptance.button_accept()
+ purchase_order._compute_wa_accepted()
+ self.assertEqual(purchase_order.wa_accepted, False)
+ work_acceptance = self._create_work_acceptance(qty=8, po=purchase_order)
+ work_acceptance.button_accept()
+ purchase_order._compute_wa_accepted()
+ self.assertEqual(purchase_order.wa_accepted, True)
diff --git a/purchase_work_acceptance/views/purchase_views.xml b/purchase_work_acceptance/views/purchase_views.xml
index c8507149522..9aeb02d23c2 100644
--- a/purchase_work_acceptance/views/purchase_views.xml
+++ b/purchase_work_acceptance/views/purchase_views.xml
@@ -13,7 +13,7 @@
class="oe_highlight"
context="{'create_wa':True}"
groups="purchase_work_acceptance.group_enable_wa_on_po"
- attrs="{'invisible': [('state', 'not in', ('purchase', 'done'))]}"
+ attrs="{'invisible': ['|', ('state', 'not in', ('purchase', 'done')), ('wa_accepted', '=', True)]}"
/>
@@ -36,11 +36,28 @@
position="attributes"
>
- {'column_invisible': [('parent.state', 'not in', ('purchase',
- 'done'))], 'readonly': ['|', ('product_type', 'in', ('consu',
+ {'column_invisible': [('parent.state', 'not in', ('purchase', 'done'))],
+ 'readonly': ['|', ('product_type', 'in', ('consu',
'product')), ('wa_line_ids', '!=', ())]}
+
+
+
+
+
+
+
From 6da9bb0c47b5afd76e3c36c7d9f6e8fca11689a8 Mon Sep 17 00:00:00 2001
From: oca-travis
Date: Wed, 10 Feb 2021 06:24:49 +0000
Subject: [PATCH 022/210] [UPD] Update purchase_work_acceptance.pot
---
.../i18n/purchase_work_acceptance.pot | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
index 4949eecde55..e23f6cfdd62 100644
--- a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
+++ b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
@@ -37,6 +37,7 @@ msgstr ""
#. module: purchase_work_acceptance
#: model:ir.model.fields.selection,name:purchase_work_acceptance.selection__work_acceptance__state__accept
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.purchase_order_form_inherit
#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
msgid "Accepted"
msgstr ""
@@ -52,6 +53,11 @@ msgstr ""
msgid "Accepted Date"
msgstr ""
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order_line__qty_accepted
+msgid "Accepted Qty."
+msgstr ""
+
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__access_warning
msgid "Access warning"
@@ -509,6 +515,16 @@ msgstr ""
msgid "Subtotal"
msgstr ""
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.purchase_order_form_inherit
+msgid "To Accept"
+msgstr ""
+
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order_line__qty_to_accept
+msgid "To Accept Qty."
+msgstr ""
+
#. module: purchase_work_acceptance
#: model:ir.model.fields,help:purchase_work_acceptance.field_account_bank_statement_line__wa_id
#: model:ir.model.fields,help:purchase_work_acceptance.field_account_move__wa_id
@@ -567,6 +583,11 @@ msgstr ""
msgid "WA"
msgstr ""
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order__wa_accepted
+msgid "WA Accepted"
+msgstr ""
+
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order__wa_line_ids
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order_line__wa_line_ids
From 1dbc38cb5b2da9d5ed2ba5727ac0fc92d0231693 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Wed, 10 Feb 2021 06:40:33 +0000
Subject: [PATCH 023/210] purchase_work_acceptance 14.0.1.0.2
---
purchase_work_acceptance/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index 09e3cf8514a..ff7f785c15f 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Work Acceptance",
- "version": "14.0.1.0.1",
+ "version": "14.0.1.0.2",
"category": "Purchase Management",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
From cca24433fa0d2c35f48f482e619cd347e5d09f28 Mon Sep 17 00:00:00 2001
From: Prapassorn Sornkaew
Date: Mon, 8 Feb 2021 08:41:20 +0000
Subject: [PATCH 024/210] [FIX] purchase_work_acceptance_wa_domain: stock
picking domain wa_id
---
purchase_work_acceptance/models/stock_picking.py | 4 ----
purchase_work_acceptance/views/purchase_views.xml | 1 +
purchase_work_acceptance/views/stock_picking_views.xml | 2 ++
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/purchase_work_acceptance/models/stock_picking.py b/purchase_work_acceptance/models/stock_picking.py
index ed5cb556789..7b4ade55ae3 100644
--- a/purchase_work_acceptance/models/stock_picking.py
+++ b/purchase_work_acceptance/models/stock_picking.py
@@ -13,10 +13,6 @@ class Picking(models.Model):
comodel_name="work.acceptance",
string="WA Reference",
copy=False,
- domain=lambda self: [
- ("state", "=", "accept"),
- ("purchase_id", "=", self._context.get("active_id")),
- ],
)
def _compute_require_wa(self):
diff --git a/purchase_work_acceptance/views/purchase_views.xml b/purchase_work_acceptance/views/purchase_views.xml
index 9aeb02d23c2..c144e21d7c6 100644
--- a/purchase_work_acceptance/views/purchase_views.xml
+++ b/purchase_work_acceptance/views/purchase_views.xml
@@ -55,6 +55,7 @@
diff --git a/purchase_work_acceptance/views/stock_picking_views.xml b/purchase_work_acceptance/views/stock_picking_views.xml
index 24c790f1408..1ed2cbc6b39 100644
--- a/purchase_work_acceptance/views/stock_picking_views.xml
+++ b/purchase_work_acceptance/views/stock_picking_views.xml
@@ -7,10 +7,12 @@
+
Date: Fri, 12 Mar 2021 01:57:03 +0000
Subject: [PATCH 025/210] purchase_work_acceptance 14.0.1.0.3
---
purchase_work_acceptance/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index ff7f785c15f..46b31064819 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Work Acceptance",
- "version": "14.0.1.0.2",
+ "version": "14.0.1.0.3",
"category": "Purchase Management",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
From fc17b170538201a74bdb36bb56d1d6ef005dcf42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?H=C3=A9ctor=20Villarreal=20Ortega?=
Date: Mon, 26 Apr 2021 12:03:25 +0200
Subject: [PATCH 026/210] [FIX] purchase_work_acceptance: Set invoice date
manually on tests
---
purchase_work_acceptance/tests/test_purchase_work_acceptance.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
index e064ad8bc26..d12ac5bce04 100644
--- a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
+++ b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
@@ -191,6 +191,7 @@ def test_02_flow_product(self):
invoice.action_post() # Warn when quantity not equal to WA
invoice_line.quantity = qty
self.assertEqual(invoice.state, "draft")
+ invoice.invoice_date = invoice.date
invoice.action_post()
self.assertEqual(invoice.state, "posted")
@@ -213,6 +214,7 @@ def test_03_flow_service(self):
invoice = f.save()
invoice.wa_id = work_acceptance
self.assertEqual(invoice.state, "draft")
+ invoice.invoice_date = invoice.date
invoice.action_post()
self.assertEqual(invoice.state, "posted")
From d92df2d6396c102c7262c631577ed2a792bf6f8d Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Tue, 27 Apr 2021 06:52:51 +0000
Subject: [PATCH 027/210] purchase_work_acceptance 14.0.1.0.4
---
purchase_work_acceptance/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index 46b31064819..3b4b1f2e198 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Work Acceptance",
- "version": "14.0.1.0.3",
+ "version": "14.0.1.0.4",
"category": "Purchase Management",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
From 52c3d5c3ea2e74b1e4a0cf327902f41c2e2801ee Mon Sep 17 00:00:00 2001
From: Kitti U
Date: Mon, 31 May 2021 21:46:33 +0700
Subject: [PATCH 028/210] [14.0][FIX] purchase_work_acceptance,
action.sudo().read()
---
purchase_work_acceptance/models/purchase.py | 2 +-
.../wizard/select_work_acceptance_wizard.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/purchase_work_acceptance/models/purchase.py b/purchase_work_acceptance/models/purchase.py
index 084740d1a16..c7e7dfc6418 100644
--- a/purchase_work_acceptance/models/purchase.py
+++ b/purchase_work_acceptance/models/purchase.py
@@ -31,7 +31,7 @@ def _compute_wa_ids(self):
def action_view_wa(self):
self.ensure_one()
act = self.env.ref("purchase_work_acceptance.action_work_acceptance")
- result = act.read()[0]
+ result = act.sudo().read()[0]
create_wa = self.env.context.get("create_wa", False)
result["context"] = {
"default_purchase_id": self.id,
diff --git a/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
index 8f5e8f3882c..cf5746dcb99 100644
--- a/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
+++ b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
@@ -32,7 +32,7 @@ def button_create_vendor_bill(self):
):
raise ValidationError(_("%s was used in some bill.") % self.wa_id.name)
action = self.env.ref("account.action_move_in_invoice_type")
- result = action.read()[0]
+ result = action.sudo().read()[0]
result["context"] = {
"default_move_type": "in_invoice",
"default_wa_id": self.wa_id.id,
From 6f4c45223f395edc16889c21f8dac6d77dda09e9 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Mon, 31 May 2021 15:13:46 +0000
Subject: [PATCH 029/210] purchase_work_acceptance 14.0.1.0.5
---
purchase_work_acceptance/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index 3b4b1f2e198..2d72a36cc29 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Work Acceptance",
- "version": "14.0.1.0.4",
+ "version": "14.0.1.0.5",
"category": "Purchase Management",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
From 46b8f74713e168160250a501dc921186457ccddb Mon Sep 17 00:00:00 2001
From: oca-travis
Date: Thu, 17 Jun 2021 14:38:04 +0000
Subject: [PATCH 030/210] [UPD] Update purchase_work_acceptance.pot
---
purchase_work_acceptance/i18n/purchase_work_acceptance.pot | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
index e23f6cfdd62..863c6e202ca 100644
--- a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
+++ b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
@@ -334,6 +334,11 @@ msgstr ""
msgid "Messages"
msgstr ""
+#. module: purchase_work_acceptance
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__my_activity_date_deadline
+msgid "My Activity Deadline"
+msgstr ""
+
#. module: purchase_work_acceptance
#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
msgid "My Work Acceptance"
From f2f3c7846be445029967f7eb465b2eaeef75e4ca Mon Sep 17 00:00:00 2001
From: newtratip
Date: Wed, 25 Aug 2021 22:46:20 +0700
Subject: [PATCH 031/210] [14.0][FIX] purchase_vendor_bill_id cannot be located
in parent view
---
purchase_work_acceptance/views/account_move_views.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/purchase_work_acceptance/views/account_move_views.xml b/purchase_work_acceptance/views/account_move_views.xml
index 3674b903774..6f8b85713b8 100644
--- a/purchase_work_acceptance/views/account_move_views.xml
+++ b/purchase_work_acceptance/views/account_move_views.xml
@@ -5,7 +5,7 @@
account.move
-
+
+
From da94b7a6f9a1856e5eb658f6863589f2939ce562 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Thu, 2 Sep 2021 08:59:23 +0000
Subject: [PATCH 032/210] purchase_work_acceptance 14.0.1.1.0
---
purchase_work_acceptance/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index 2d72a36cc29..ffa6126c9db 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Work Acceptance",
- "version": "14.0.1.0.5",
+ "version": "14.0.1.1.0",
"category": "Purchase Management",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
From 1ce17d6c642c309e75d8ea6a78cb51ffadb59830 Mon Sep 17 00:00:00 2001
From: Kitti U
Date: Tue, 15 Jun 2021 22:43:57 +0700
Subject: [PATCH 033/210] [14.0][IMP] purchase_work_acceptance, v14
action_create_invoice
---
purchase_work_acceptance/models/purchase.py | 18 ++++++++----
.../models/work_acceptance.py | 6 ----
.../tests/test_purchase_work_acceptance.py | 28 ++++++++-----------
.../wizard/select_work_acceptance_wizard.py | 20 +++++--------
4 files changed, 31 insertions(+), 41 deletions(-)
diff --git a/purchase_work_acceptance/models/purchase.py b/purchase_work_acceptance/models/purchase.py
index c7e7dfc6418..504b26b2d88 100644
--- a/purchase_work_acceptance/models/purchase.py
+++ b/purchase_work_acceptance/models/purchase.py
@@ -68,9 +68,11 @@ def action_view_wa(self):
return result
def action_create_invoice(self):
- if self.env.context.get("create_bill", False) and self.env.user.has_group(
+ enable_wa = self.env.user.has_group(
"purchase_work_acceptance.group_enable_wa_on_invoice"
- ):
+ )
+ ctx = self.env.context.copy()
+ if enable_wa and ctx.get("create_bill"):
wizard = self.env.ref(
"purchase_work_acceptance.view_select_work_acceptance_wizard"
)
@@ -90,6 +92,11 @@ def _compute_wa_accepted(self):
lines = order.order_line.filtered(lambda l: l.qty_to_accept > 0)
order.wa_accepted = not any(lines)
+ def _prepare_invoice(self):
+ invoice_vals = super()._prepare_invoice()
+ invoice_vals["wa_id"] = self.env.context.get("wa_id")
+ return invoice_vals
+
class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"
@@ -123,9 +130,10 @@ def _get_product_qty(self):
)
def _prepare_account_move_line(self, move=False):
- res = super()._prepare_account_move_line(move)
- if move and move.wa_id:
- wa_line = self.wa_line_ids.filtered(lambda l: l.wa_id == move.wa_id)
+ res = super()._prepare_account_move_line(move=move)
+ wa_id = self.env.context.get("wa_id")
+ if wa_id:
+ wa_line = self.wa_line_ids.filtered(lambda l: l.wa_id.id == wa_id)
res["quantity"] = wa_line.product_qty
res["product_uom_id"] = wa_line.product_uom
return res
diff --git a/purchase_work_acceptance/models/work_acceptance.py b/purchase_work_acceptance/models/work_acceptance.py
index 7b1ee8b84a2..f2af2e4d0a2 100644
--- a/purchase_work_acceptance/models/work_acceptance.py
+++ b/purchase_work_acceptance/models/work_acceptance.py
@@ -104,12 +104,6 @@ def create(self, vals):
def button_accept(self, force=False):
self._unlink_zero_quantity()
- po_lines = self.purchase_id.order_line
- for po_line in po_lines:
- if po_line.product_id.type not in ["product", "consu"]:
- po_line.qty_received = self.wa_line_ids.filtered(
- lambda l: l.purchase_line_id == po_line
- ).product_qty
self.write({"state": "accept", "date_accept": fields.Datetime.now()})
def button_draft(self):
diff --git a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
index d12ac5bce04..6aa521f3bc7 100644
--- a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
+++ b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
@@ -10,6 +10,7 @@ class TestPurchaseWorkAcceptance(TransactionCase):
def setUp(self):
super().setUp()
self.service_product = self.env.ref("product.product_product_1")
+ self.service_product.purchase_method = "purchase"
self.product_product = self.env.ref("product.product_product_6")
self.res_partner = self.env.ref("base.res_partner_3")
self.employee = self.env.ref("base.user_demo")
@@ -226,21 +227,17 @@ def test_04_enable_config_flow(self):
# Create Work Acceptance
work_acceptance = self._create_work_acceptance(qty, purchase_order)
work_acceptance.button_accept()
- res = purchase_order.with_context(create_bill=True).action_create_invoice()
- self.assertEqual(res.get("res_model"), "account.move")
- # enable wa on invoice
self.env["res.config.settings"].create(
{"group_enable_wa_on_invoice": True}
).execute()
res = purchase_order.with_context(create_bill=True).action_create_invoice()
self.assertEqual(res.get("res_model"), "select.work.acceptance.wizard")
wizard = self.env[res.get("res_model")].create({"wa_id": work_acceptance.id})
- wiz = wizard.button_create_vendor_bill()
- ctx = wiz.get("context")
- f = Form(
- self.env["account.move"].with_context(ctx), view="account.view_move_form"
- )
- f.save()
+ res = wizard.with_context(
+ active_id=purchase_order.id
+ ).button_create_vendor_bill()
+ invoice = self.env["account.move"].browse(res["res_id"])
+ self.assertEqual(sum(invoice.invoice_line_ids.mapped("quantity")), qty)
def test_05_create_multi_lines(self):
qty = 5.0
@@ -266,14 +263,11 @@ def test_05_create_multi_lines(self):
res = purchase_order.with_context(create_bill=True).action_create_invoice()
self.assertEqual(res.get("res_model"), "select.work.acceptance.wizard")
wizard = self.env[res.get("res_model")].create({"wa_id": work_acceptance.id})
- wiz = wizard.button_create_vendor_bill()
- ctx = wiz.get("context")
- f = Form(
- self.env["account.move"].with_context(ctx), view="account.view_move_form"
- )
- invoice = f.save()
- with self.assertRaises(ValidationError):
- invoice.action_post()
+ res = wizard.with_context(
+ active_id=purchase_order.id
+ ).button_create_vendor_bill()
+ invoice = self.env["account.move"].browse(res["res_id"])
+ self.assertEqual(sum(invoice.invoice_line_ids.mapped("quantity")), qty * 2)
def test_06_check_qty_accepted(self):
qty_po = 20.0
diff --git a/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
index cf5746dcb99..ddd7abfdcdd 100644
--- a/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
+++ b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
@@ -28,17 +28,11 @@ def button_create_vendor_bill(self):
order = self.env["purchase.order"].browse(self._context.get("active_id"))
if any(
(invoice.wa_id and invoice.wa_id == self.wa_id)
- for invoice in order.invoice_ids
+ for invoice in order.invoice_ids.filtered(lambda l: l.state == "posted")
):
- raise ValidationError(_("%s was used in some bill.") % self.wa_id.name)
- action = self.env.ref("account.action_move_in_invoice_type")
- result = action.sudo().read()[0]
- result["context"] = {
- "default_move_type": "in_invoice",
- "default_wa_id": self.wa_id.id,
- "default_purchase_id": self._context.get("active_id"),
- "default_company_id": self.wa_id.company_id.id or self.env.company.id,
- }
- res = self.env.ref("account.view_move_form", False)
- result["views"] = [(res and res.id or False, "form")]
- return result
+ raise ValidationError(
+ _("%s was already used by some bill") % self.wa_id.name
+ )
+ return order.with_context(
+ create_bill=False, wa_id=self.wa_id.id
+ ).action_create_invoice()
From 72cd52368887368921d4d81a4decd90389cdf1f8 Mon Sep 17 00:00:00 2001
From: Kitti U
Date: Tue, 22 Jun 2021 22:10:40 +0700
Subject: [PATCH 034/210] Choosing WA, for invoice/picking, list only unsued WA
---
.../models/stock_picking.py | 86 +++++++++++--------
.../models/work_acceptance.py | 19 ++++
.../views/stock_picking_views.xml | 2 +-
.../wizard/select_work_acceptance_wizard.py | 21 +++--
4 files changed, 81 insertions(+), 47 deletions(-)
diff --git a/purchase_work_acceptance/models/stock_picking.py b/purchase_work_acceptance/models/stock_picking.py
index 7b4ade55ae3..2e0789eaef5 100644
--- a/purchase_work_acceptance/models/stock_picking.py
+++ b/purchase_work_acceptance/models/stock_picking.py
@@ -12,8 +12,13 @@ class Picking(models.Model):
wa_id = fields.Many2one(
comodel_name="work.acceptance",
string="WA Reference",
+ domain="[('id', 'in', wa_ids)]",
copy=False,
)
+ wa_ids = fields.Many2many(
+ comodel_name="work.acceptance",
+ compute="_compute_wa_ids",
+ )
def _compute_require_wa(self):
if self.picking_type_code == "incoming":
@@ -23,45 +28,52 @@ def _compute_require_wa(self):
else:
self.require_wa = False
+ @api.depends("require_wa")
+ def _compute_wa_ids(self):
+ for picking in self:
+ picking.wa_ids = self.env["work.acceptance"]._get_valid_wa(
+ "picking", picking.purchase_id.id
+ )
+
def button_validate(self):
- if self.wa_id:
- order = self.env["purchase.order"].browse(self._context.get("active_id"))
- if any(
- picking.wa_id == self.wa_id and picking != self
- for picking in order.picking_ids
- ):
- raise ValidationError(
- _("%s was used in some picking.") % self.wa_id.name
- )
- wa_line = {}
- for line in self.wa_id.wa_line_ids:
- qty = line.product_uom._compute_quantity(
- line.product_qty, line.product_id.uom_id
- )
- if qty > 0.0 and line.product_id.type in ["product", "consu"]:
- if line.product_id.id in wa_line.keys():
- qty_old = wa_line[line.product_id.id]
- wa_line[line.product_id.id] = qty_old + qty
- else:
- wa_line[line.product_id.id] = qty
- move_line = {}
- for move in self.move_ids_without_package:
- qty = move.product_uom._compute_quantity(
- move.quantity_done, line.product_id.uom_id
- )
- if qty > 0.0:
- if move.product_id.id in move_line.keys():
- qty_old = move_line[move.product_id.id]
- move_line[move.product_id.id] = qty_old + qty
- else:
- move_line[move.product_id.id] = qty
- if wa_line != move_line:
- raise ValidationError(
- _(
- "You cannot validate a transfer if done"
- " quantity not equal accepted quantity"
+ for picking in self:
+ if picking.wa_id:
+ order_id = self._context.get("active_id")
+ wa = self.env["work.acceptance"]._get_valid_wa("picking", order_id)
+ wa += picking.wa_id
+ if picking.wa_id not in wa:
+ raise ValidationError(
+ _("%s was used in some picking.") % picking.wa_id.name
+ )
+ wa_line = {}
+ for line in picking.wa_id.wa_line_ids:
+ qty = line.product_uom._compute_quantity(
+ line.product_qty, line.product_id.uom_id
+ )
+ if qty > 0.0 and line.product_id.type in ["product", "consu"]:
+ if line.product_id.id in wa_line.keys():
+ qty_old = wa_line[line.product_id.id]
+ wa_line[line.product_id.id] = qty_old + qty
+ else:
+ wa_line[line.product_id.id] = qty
+ move_line = {}
+ for move in picking.move_ids_without_package:
+ qty = move.product_uom._compute_quantity(
+ move.quantity_done, line.product_id.uom_id
+ )
+ if qty > 0.0:
+ if move.product_id.id in move_line.keys():
+ qty_old = move_line[move.product_id.id]
+ move_line[move.product_id.id] = qty_old + qty
+ else:
+ move_line[move.product_id.id] = qty
+ if wa_line != move_line:
+ raise ValidationError(
+ _(
+ "You cannot validate a transfer if done"
+ " quantity not equal accepted quantity"
+ )
)
- )
return super(Picking, self).button_validate()
@api.onchange("wa_id")
diff --git a/purchase_work_acceptance/models/work_acceptance.py b/purchase_work_acceptance/models/work_acceptance.py
index f2af2e4d0a2..cd521c1e7a7 100644
--- a/purchase_work_acceptance/models/work_acceptance.py
+++ b/purchase_work_acceptance/models/work_acceptance.py
@@ -127,6 +127,25 @@ def _unlink_zero_quantity(self):
)
wa_line_zero_quantity.unlink()
+ def _get_valid_wa(self, doctype, order_id):
+ """ Get unused WA when validate invoice or picking """
+ order = self.env["purchase.order"].browse(order_id)
+ all_wa = self.env["work.acceptance"].search(
+ [
+ ("state", "=", "accept"),
+ ("purchase_id", "=", order.id),
+ ]
+ )
+ if doctype == "invoice":
+ used_wa = order.invoice_ids.filtered(lambda l: l.state == "posted").mapped(
+ "wa_id"
+ )
+ return all_wa - used_wa
+ if doctype == "picking":
+ used_wa = order.picking_ids.mapped("wa_id")
+ return all_wa - used_wa
+ return all_wa
+
class WorkAcceptanceLine(models.Model):
_name = "work.acceptance.line"
diff --git a/purchase_work_acceptance/views/stock_picking_views.xml b/purchase_work_acceptance/views/stock_picking_views.xml
index 1ed2cbc6b39..f90671f9c3d 100644
--- a/purchase_work_acceptance/views/stock_picking_views.xml
+++ b/purchase_work_acceptance/views/stock_picking_views.xml
@@ -12,11 +12,11 @@
name="wa_id"
options="{'no_create': True}"
groups="purchase_work_acceptance.group_enable_wa_on_in"
- domain="[('state', '=', 'accept'),('purchase_id', '=', purchase_id)]"
attrs="{'required': [('require_wa','=', True)],
'readonly':[('state', 'in' , ('done', 'cancel'))],
'invisible': ['|', ('id', '=', False), ('picking_type_code', '!=', 'incoming')]}"
/>
+
diff --git a/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
index ddd7abfdcdd..ba7d250e00d 100644
--- a/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
+++ b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
@@ -13,10 +13,7 @@ class SelectWorkAcceptanceWizard(models.TransientModel):
wa_id = fields.Many2one(
comodel_name="work.acceptance",
string="Work Acceptance",
- domain=lambda self: [
- ("state", "=", "accept"),
- ("purchase_id", "=", self._context.get("active_id")),
- ],
+ domain=lambda self: self._get_wa_domain(),
)
def _get_require_wa(self):
@@ -24,15 +21,21 @@ def _get_require_wa(self):
"purchase_work_acceptance.group_enforce_wa_on_invoice"
)
+ def _get_wa_domain(self):
+ wa = self.env["work.acceptance"]._get_valid_wa(
+ "invoice", self.env.context.get("active_id")
+ )
+ return [("id", "in", wa.ids)]
+
def button_create_vendor_bill(self):
- order = self.env["purchase.order"].browse(self._context.get("active_id"))
- if any(
- (invoice.wa_id and invoice.wa_id == self.wa_id)
- for invoice in order.invoice_ids.filtered(lambda l: l.state == "posted")
- ):
+ self.ensure_one()
+ order_id = self._context.get("active_id")
+ wa = self.env["work.acceptance"]._get_valid_wa("invoice", order_id)
+ if self.wa_id not in wa:
raise ValidationError(
_("%s was already used by some bill") % self.wa_id.name
)
+ order = self.env["purchase.order"].browse(order_id)
return order.with_context(
create_bill=False, wa_id=self.wa_id.id
).action_create_invoice()
From 3356147ced2b58e8499a013f769a1a00f38cda58 Mon Sep 17 00:00:00 2001
From: Kitti U
Date: Wed, 23 Jun 2021 15:42:09 +0700
Subject: [PATCH 035/210] Specify product qty, only when > 0 (to support
deposit case)
---
purchase_work_acceptance/models/purchase.py | 5 +++--
.../wizard/select_work_acceptance_wizard.py | 15 ++++++++++-----
.../select_work_acceptance_wizard_views.xml | 1 +
3 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/purchase_work_acceptance/models/purchase.py b/purchase_work_acceptance/models/purchase.py
index 504b26b2d88..6c38d9d6bc9 100644
--- a/purchase_work_acceptance/models/purchase.py
+++ b/purchase_work_acceptance/models/purchase.py
@@ -134,8 +134,9 @@ def _prepare_account_move_line(self, move=False):
wa_id = self.env.context.get("wa_id")
if wa_id:
wa_line = self.wa_line_ids.filtered(lambda l: l.wa_id.id == wa_id)
- res["quantity"] = wa_line.product_qty
- res["product_uom_id"] = wa_line.product_uom
+ if res.get("quantity", 0) >= 0:
+ res["quantity"] = wa_line.product_qty
+ res["product_uom_id"] = wa_line.product_uom
return res
@api.depends(
diff --git a/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
index ba7d250e00d..5c083292d11 100644
--- a/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
+++ b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
@@ -1,7 +1,7 @@
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-from odoo import _, fields, models
+from odoo import _, api, fields, models
from odoo.exceptions import ValidationError
@@ -13,7 +13,11 @@ class SelectWorkAcceptanceWizard(models.TransientModel):
wa_id = fields.Many2one(
comodel_name="work.acceptance",
string="Work Acceptance",
- domain=lambda self: self._get_wa_domain(),
+ domain="[('id', 'in', wa_ids)]",
+ )
+ wa_ids = fields.Many2many(
+ comodel_name="work.acceptance",
+ compute="_compute_wa_ids",
)
def _get_require_wa(self):
@@ -21,11 +25,12 @@ def _get_require_wa(self):
"purchase_work_acceptance.group_enforce_wa_on_invoice"
)
- def _get_wa_domain(self):
- wa = self.env["work.acceptance"]._get_valid_wa(
+ @api.depends("require_wa")
+ def _compute_wa_ids(self):
+ self.ensure_one()
+ self.wa_ids = self.env["work.acceptance"]._get_valid_wa(
"invoice", self.env.context.get("active_id")
)
- return [("id", "in", wa.ids)]
def button_create_vendor_bill(self):
self.ensure_one()
diff --git a/purchase_work_acceptance/wizard/select_work_acceptance_wizard_views.xml b/purchase_work_acceptance/wizard/select_work_acceptance_wizard_views.xml
index 1814112d23f..0d785a95581 100644
--- a/purchase_work_acceptance/wizard/select_work_acceptance_wizard_views.xml
+++ b/purchase_work_acceptance/wizard/select_work_acceptance_wizard_views.xml
@@ -13,6 +13,7 @@
options="{'no_create': True}"
attrs="{'required': [('require_wa','=', True)]}"
/>
+
Date: Thu, 24 Jun 2021 23:15:38 +0700
Subject: [PATCH 036/210] Create invoice by WA, with line qty > 0 only
---
purchase_work_acceptance/models/account_move.py | 9 +++++++++
purchase_work_acceptance/models/purchase.py | 2 +-
purchase_work_acceptance/models/work_acceptance.py | 4 +++-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/purchase_work_acceptance/models/account_move.py b/purchase_work_acceptance/models/account_move.py
index ffeab4e63cd..303c23dc9f7 100644
--- a/purchase_work_acceptance/models/account_move.py
+++ b/purchase_work_acceptance/models/account_move.py
@@ -71,3 +71,12 @@ def action_post(self):
)
)
return super().action_post()
+
+ @api.model
+ def create(self, vals):
+ if self.env.context.get("wa_id"):
+ # When use WA, filter for line with qty > 0
+ lines = vals.get("invoice_line_ids", [])
+ lines = filter(lambda l: len(l) == 3 and l[2].get("quantity") > 0, lines)
+ vals["invoice_line_ids"] = list(lines)
+ return super().create(vals)
diff --git a/purchase_work_acceptance/models/purchase.py b/purchase_work_acceptance/models/purchase.py
index 6c38d9d6bc9..149de328155 100644
--- a/purchase_work_acceptance/models/purchase.py
+++ b/purchase_work_acceptance/models/purchase.py
@@ -154,7 +154,7 @@ def _compute_qty_accepted(self):
lambda l: l.wa_id.state == "accept"
):
qty += wa_line.product_uom._compute_quantity(
- wa_line.product_qty, line.product_uom
+ wa_line.product_qty, line.product_uom, round=False
)
line.qty_accepted = qty
diff --git a/purchase_work_acceptance/models/work_acceptance.py b/purchase_work_acceptance/models/work_acceptance.py
index cd521c1e7a7..6eee811e00d 100644
--- a/purchase_work_acceptance/models/work_acceptance.py
+++ b/purchase_work_acceptance/models/work_acceptance.py
@@ -153,7 +153,9 @@ class WorkAcceptanceLine(models.Model):
_order = "id"
name = fields.Text(string="Description", required=True)
- product_qty = fields.Float(string="Quantity", required=True)
+ product_qty = fields.Float(
+ string="Quantity", required=True, digits="Product Unit of Measure"
+ )
product_id = fields.Many2one(
comodel_name="product.product", string="Product", required=True
)
From 54895fb3b3174d71230f19d7d35609da375deea7 Mon Sep 17 00:00:00 2001
From: Kitti U
Date: Thu, 1 Jul 2021 21:21:07 +0700
Subject: [PATCH 037/210] Click accept, will popup wziard for date
---
purchase_work_acceptance/__manifest__.py | 1 +
.../models/work_acceptance.py | 16 ++++++++++-
.../security/ir.model.access.csv | 1 +
.../views/work_acceptance_views.xml | 1 +
purchase_work_acceptance/wizard/__init__.py | 1 +
.../wizard/work_accepted_date_wizard.py | 21 +++++++++++++++
.../wizard/work_accepted_date_wizard.xml | 27 +++++++++++++++++++
7 files changed, 67 insertions(+), 1 deletion(-)
create mode 100644 purchase_work_acceptance/wizard/work_accepted_date_wizard.py
create mode 100644 purchase_work_acceptance/wizard/work_accepted_date_wizard.xml
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index ffa6126c9db..b820d718056 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -19,6 +19,7 @@
"views/stock_picking_views.xml",
"views/work_acceptance_views.xml",
"wizard/select_work_acceptance_wizard_views.xml",
+ "wizard/work_accepted_date_wizard.xml",
],
"maintainer": ["ps-tubtim"],
"installable": True,
diff --git a/purchase_work_acceptance/models/work_acceptance.py b/purchase_work_acceptance/models/work_acceptance.py
index 6eee811e00d..16edd9053de 100644
--- a/purchase_work_acceptance/models/work_acceptance.py
+++ b/purchase_work_acceptance/models/work_acceptance.py
@@ -103,8 +103,22 @@ def create(self, vals):
return super(WorkAcceptance, self).create(vals)
def button_accept(self, force=False):
+ if self.env.context.get("manual_date_accept"):
+ wizard = self.env.ref(
+ "purchase_work_acceptance.view_work_accepted_date_wizard"
+ )
+ return {
+ "name": _("Select Accept Date"),
+ "type": "ir.actions.act_window",
+ "view_mode": "form",
+ "res_model": "work.accepted.date.wizard",
+ "views": [(wizard.id, "form")],
+ "view_id": wizard.id,
+ "target": "new",
+ }
self._unlink_zero_quantity()
- self.write({"state": "accept", "date_accept": fields.Datetime.now()})
+ date_accept = force or fields.Datetime.now()
+ self.write({"state": "accept", "date_accept": date_accept})
def button_draft(self):
picking_obj = self.env["stock.picking"]
diff --git a/purchase_work_acceptance/security/ir.model.access.csv b/purchase_work_acceptance/security/ir.model.access.csv
index c5e4734f292..34069fa422d 100644
--- a/purchase_work_acceptance/security/ir.model.access.csv
+++ b/purchase_work_acceptance/security/ir.model.access.csv
@@ -2,3 +2,4 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_work_acceptance,access_work_acceptance,model_work_acceptance,purchase.group_purchase_user,1,1,1,1
access_work_acceptance_line,access_work_acceptance_line,model_work_acceptance_line,purchase.group_purchase_user,1,1,1,1
access_select_work_acceptance_wizard,access_select_work_acceptance_wizard,model_select_work_acceptance_wizard,purchase.group_purchase_user,1,1,1,1
+access_work_accepted_date_wizard,access_work_accepted_date_wizard,model_work_accepted_date_wizard,purchase.group_purchase_user,1,1,1,1
diff --git a/purchase_work_acceptance/views/work_acceptance_views.xml b/purchase_work_acceptance/views/work_acceptance_views.xml
index fce1f00dd08..ea7684eb4fd 100644
--- a/purchase_work_acceptance/views/work_acceptance_views.xml
+++ b/purchase_work_acceptance/views/work_acceptance_views.xml
@@ -12,6 +12,7 @@
states="draft"
string="Accept"
class="oe_highlight"
+ context="{'manual_date_accept': True}"
/>
+
+
+ view.work.accepted.date.wizard
+ work.accepted.date.wizard
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
From c2771dc7183bc803eaf936ab966cd8472a3b3fab Mon Sep 17 00:00:00 2001
From: Kitti U
Date: Sun, 4 Jul 2021 14:50:56 +0700
Subject: [PATCH 038/210] Add purchase order in WA's list view, and filters
---
purchase_work_acceptance/models/account_move.py | 4 ++--
purchase_work_acceptance/models/purchase.py | 5 ++---
purchase_work_acceptance/views/work_acceptance_views.xml | 8 ++++++++
3 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/purchase_work_acceptance/models/account_move.py b/purchase_work_acceptance/models/account_move.py
index 303c23dc9f7..8c99434ef98 100644
--- a/purchase_work_acceptance/models/account_move.py
+++ b/purchase_work_acceptance/models/account_move.py
@@ -75,8 +75,8 @@ def action_post(self):
@api.model
def create(self, vals):
if self.env.context.get("wa_id"):
- # When use WA, filter for line with qty > 0
+ # When use WA, filter for line with qty != 0, good for deposit too.
lines = vals.get("invoice_line_ids", [])
- lines = filter(lambda l: len(l) == 3 and l[2].get("quantity") > 0, lines)
+ lines = filter(lambda l: len(l) == 3 and l[2].get("quantity") != 0, lines)
vals["invoice_line_ids"] = list(lines)
return super().create(vals)
diff --git a/purchase_work_acceptance/models/purchase.py b/purchase_work_acceptance/models/purchase.py
index 149de328155..3fb23afc376 100644
--- a/purchase_work_acceptance/models/purchase.py
+++ b/purchase_work_acceptance/models/purchase.py
@@ -134,9 +134,8 @@ def _prepare_account_move_line(self, move=False):
wa_id = self.env.context.get("wa_id")
if wa_id:
wa_line = self.wa_line_ids.filtered(lambda l: l.wa_id.id == wa_id)
- if res.get("quantity", 0) >= 0:
- res["quantity"] = wa_line.product_qty
- res["product_uom_id"] = wa_line.product_uom
+ res["quantity"] = wa_line.product_qty
+ res["product_uom_id"] = wa_line.product_uom
return res
@api.depends(
diff --git a/purchase_work_acceptance/views/work_acceptance_views.xml b/purchase_work_acceptance/views/work_acceptance_views.xml
index ea7684eb4fd..803ba2c32e8 100644
--- a/purchase_work_acceptance/views/work_acceptance_views.xml
+++ b/purchase_work_acceptance/views/work_acceptance_views.xml
@@ -146,6 +146,7 @@
groups="base.group_multi_currency"
options="{'no_create': True}"
/>
+
@@ -161,6 +162,7 @@
+
+
Date: Tue, 10 Aug 2021 15:23:08 +0700
Subject: [PATCH 039/210] On create invoice from WA, set the ref to WA too
---
.../models/account_move.py | 9 -------
purchase_work_acceptance/models/purchase.py | 25 ++++++++++++++++++-
2 files changed, 24 insertions(+), 10 deletions(-)
diff --git a/purchase_work_acceptance/models/account_move.py b/purchase_work_acceptance/models/account_move.py
index 8c99434ef98..b35a09185ce 100644
--- a/purchase_work_acceptance/models/account_move.py
+++ b/purchase_work_acceptance/models/account_move.py
@@ -29,15 +29,6 @@ def _compute_require_wa(self):
)
rec.require_wa = self.wa_id and enforce_wa
- @api.onchange("purchase_vendor_bill_id", "purchase_id")
- def _onchange_purchase_auto_complete(self):
- res = super()._onchange_purchase_auto_complete()
- if self.wa_id:
- self.write(
- {"ref": self.wa_id.invoice_ref, "currency_id": self.wa_id.currency_id}
- )
- return res
-
def action_post(self):
for rec in self:
if rec.wa_id:
diff --git a/purchase_work_acceptance/models/purchase.py b/purchase_work_acceptance/models/purchase.py
index 3fb23afc376..e1866481a3f 100644
--- a/purchase_work_acceptance/models/purchase.py
+++ b/purchase_work_acceptance/models/purchase.py
@@ -85,7 +85,30 @@ def action_create_invoice(self):
"view_id": wizard.id,
"target": "new",
}
- return super().action_create_invoice()
+ res = super().action_create_invoice()
+ # Set 'ref' to WA
+ if (
+ ctx.get("wa_id")
+ and res.get("res_model") == "account.move"
+ and res.get("res_id")
+ ):
+ wa = self.env["work.acceptance"].browse(ctx["wa_id"])
+ invoice = self.env["account.move"].browse(res["res_id"])
+ # invoice.ref, adding "/ WA001"
+ refs = []
+ if invoice.ref:
+ refs.append(invoice.ref)
+ if wa.name:
+ refs.append(wa.name)
+ invoice.ref = " / ".join(refs)
+ # invoice.payment_reference, adding "/ "
+ payment_refs = []
+ if invoice.payment_reference:
+ payment_refs.append(invoice.payment_reference)
+ if wa.invoice_ref:
+ payment_refs.append(wa.invoice_ref)
+ invoice.payment_reference = " / ".join(payment_refs)
+ return res
def _compute_wa_accepted(self):
for order in self:
From fb6235aff9fd6a858ba75375c2e91e213c9fdb05 Mon Sep 17 00:00:00 2001
From: Kitti U
Date: Tue, 21 Sep 2021 18:41:24 +0700
Subject: [PATCH 040/210] product_id in WA as readonly
---
purchase_work_acceptance/views/work_acceptance_views.xml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/views/work_acceptance_views.xml b/purchase_work_acceptance/views/work_acceptance_views.xml
index 803ba2c32e8..f1fd1c26028 100644
--- a/purchase_work_acceptance/views/work_acceptance_views.xml
+++ b/purchase_work_acceptance/views/work_acceptance_views.xml
@@ -72,7 +72,11 @@
>
-
+
From 0a6ca2c298495c1bab1d4a1fb22cf4c0689ed3cd Mon Sep 17 00:00:00 2001
From: Kitti U
Date: Tue, 21 Sep 2021 19:53:07 +0700
Subject: [PATCH 041/210] Correct security
---
purchase_work_acceptance/security/ir.model.access.csv | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/security/ir.model.access.csv b/purchase_work_acceptance/security/ir.model.access.csv
index 34069fa422d..bb3b6257f84 100644
--- a/purchase_work_acceptance/security/ir.model.access.csv
+++ b/purchase_work_acceptance/security/ir.model.access.csv
@@ -2,4 +2,4 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_work_acceptance,access_work_acceptance,model_work_acceptance,purchase.group_purchase_user,1,1,1,1
access_work_acceptance_line,access_work_acceptance_line,model_work_acceptance_line,purchase.group_purchase_user,1,1,1,1
access_select_work_acceptance_wizard,access_select_work_acceptance_wizard,model_select_work_acceptance_wizard,purchase.group_purchase_user,1,1,1,1
-access_work_accepted_date_wizard,access_work_accepted_date_wizard,model_work_accepted_date_wizard,purchase.group_purchase_user,1,1,1,1
+access_work_accepted_date_wizard,access_work_accepted_date_wizard,model_work_accepted_date_wizard,,1,1,1,1
From 79a1ea988921c21f658f21216ba918fe1761ebdf Mon Sep 17 00:00:00 2001
From: Kitti U
Date: Fri, 24 Sep 2021 19:54:07 +0700
Subject: [PATCH 042/210] Add 'WA not required' option on Operation Type
---
purchase_work_acceptance/__manifest__.py | 1 +
.../models/stock_picking.py | 25 ++++++++++++++-----
.../models/work_acceptance.py | 6 ++---
purchase_work_acceptance/readme/CONFIGURE.rst | 1 +
.../views/stock_picking_type_views.xml | 13 ++++++++++
5 files changed, 37 insertions(+), 9 deletions(-)
create mode 100644 purchase_work_acceptance/views/stock_picking_type_views.xml
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index b820d718056..bad0576d12a 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -17,6 +17,7 @@
"views/purchase_views.xml",
"views/res_config_settings_views.xml",
"views/stock_picking_views.xml",
+ "views/stock_picking_type_views.xml",
"views/work_acceptance_views.xml",
"wizard/select_work_acceptance_wizard_views.xml",
"wizard/work_accepted_date_wizard.xml",
diff --git a/purchase_work_acceptance/models/stock_picking.py b/purchase_work_acceptance/models/stock_picking.py
index 2e0789eaef5..8f7fd2d8b26 100644
--- a/purchase_work_acceptance/models/stock_picking.py
+++ b/purchase_work_acceptance/models/stock_picking.py
@@ -21,12 +21,16 @@ class Picking(models.Model):
)
def _compute_require_wa(self):
- if self.picking_type_code == "incoming":
- self.require_wa = self.env.user.has_group(
- "purchase_work_acceptance.group_enforce_wa_on_in"
- )
- else:
- self.require_wa = False
+ for rec in self:
+ if rec.picking_type_id.bypass_wa:
+ rec.require_wa = False
+ continue
+ if rec.picking_type_code == "incoming":
+ rec.require_wa = self.env.user.has_group(
+ "purchase_work_acceptance.group_enforce_wa_on_in"
+ )
+ continue
+ rec.require_wa = False
@api.depends("require_wa")
def _compute_wa_ids(self):
@@ -97,3 +101,12 @@ def _onchange_wa_id(self):
wa_line[line.product_id.id] = qty - move_line.product_uom_qty
else:
move_line._origin.qty_done = qty
+
+
+class StockPickingType(models.Model):
+ _inherit = "stock.picking.type"
+
+ bypass_wa = fields.Boolean(
+ string="WA not required",
+ help="When 'Enforce WA on Goods Receipt' is set, this option type can by pass it",
+ )
diff --git a/purchase_work_acceptance/models/work_acceptance.py b/purchase_work_acceptance/models/work_acceptance.py
index 16edd9053de..bef3b37c987 100644
--- a/purchase_work_acceptance/models/work_acceptance.py
+++ b/purchase_work_acceptance/models/work_acceptance.py
@@ -151,9 +151,9 @@ def _get_valid_wa(self, doctype, order_id):
]
)
if doctype == "invoice":
- used_wa = order.invoice_ids.filtered(lambda l: l.state == "posted").mapped(
- "wa_id"
- )
+ used_wa = order.invoice_ids.filtered(
+ lambda l: l.state in ("draft", "posted")
+ ).mapped("wa_id")
return all_wa - used_wa
if doctype == "picking":
used_wa = order.picking_ids.mapped("wa_id")
diff --git a/purchase_work_acceptance/readme/CONFIGURE.rst b/purchase_work_acceptance/readme/CONFIGURE.rst
index 7a071edf319..c76fbaec47b 100644
--- a/purchase_work_acceptance/readme/CONFIGURE.rst
+++ b/purchase_work_acceptance/readme/CONFIGURE.rst
@@ -27,4 +27,5 @@ Note:
* You can check 'Enable WA on Goods Receipt' and 'Enable WA on Vendor Bill' after checked 'Enable WA on Purchase Order'
* You can check 'Enforce WA on Goods Receipt' after checked 'Enable WA on Goods Receipt'
+ * But you can bypass WA on some Picking Operation by setting 'WA not required' on Operation Type
* You can check 'Enforce WA on Vendor Bill' after checked 'Enable WA on Vendor Bill'
diff --git a/purchase_work_acceptance/views/stock_picking_type_views.xml b/purchase_work_acceptance/views/stock_picking_type_views.xml
new file mode 100644
index 00000000000..09908c1356c
--- /dev/null
+++ b/purchase_work_acceptance/views/stock_picking_type_views.xml
@@ -0,0 +1,13 @@
+
+
+
+ view.picking.type.form
+ stock.picking.type
+
+
+
+
+
+
+
+
From d582bbd7673f6d9ed39e4a8b1d867f9ca560ce39 Mon Sep 17 00:00:00 2001
From: Alba Riera
Date: Mon, 4 Oct 2021 11:24:37 +0200
Subject: [PATCH 043/210] [FIX] purchase_work_acceptance: fix view_move_form
view
---
purchase_work_acceptance/views/account_move_views.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/views/account_move_views.xml b/purchase_work_acceptance/views/account_move_views.xml
index 6f8b85713b8..1b2e2c51965 100644
--- a/purchase_work_acceptance/views/account_move_views.xml
+++ b/purchase_work_acceptance/views/account_move_views.xml
@@ -3,7 +3,7 @@
account.move.form
account.move
-
+
@@ -487,6 +488,8 @@
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
+Current maintainer :
+
This module is part of the OCA/purchase-workflow project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute .
From 11a9998767b6cd522615eb93e4d3c2e77dcd7ccd Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Tue, 8 Mar 2022 13:05:58 +0000
Subject: [PATCH 052/210] purchase_work_acceptance 14.0.1.2.0
---
purchase_work_acceptance/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index 8f4db85990c..e26f958c667 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Work Acceptance",
- "version": "14.0.1.1.1",
+ "version": "14.0.1.2.0",
"category": "Purchase Management",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
From 61e1d6b7927623352ab2e36c328df20461737820 Mon Sep 17 00:00:00 2001
From: oca-travis
Date: Wed, 23 Mar 2022 13:12:01 +0000
Subject: [PATCH 053/210] [UPD] Update purchase_work_acceptance.pot
---
.../i18n/purchase_work_acceptance.pot | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
index 864cc8e460d..df267a3a262 100644
--- a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
+++ b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
@@ -112,11 +112,6 @@ msgstr ""
msgid "Company"
msgstr ""
-#. module: purchase_work_acceptance
-#: model:ir.model,name:purchase_work_acceptance.model_res_config_settings
-msgid "Config Settings"
-msgstr ""
-
#. module: purchase_work_acceptance
#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_select_work_acceptance_wizard
msgid "Create Vendor Bill"
@@ -422,6 +417,11 @@ msgstr ""
msgid "Portal Access URL"
msgstr ""
+#. module: purchase_work_acceptance
+#: model:ir.model,name:purchase_work_acceptance.model_res_config_settings
+msgid "Procurement purchase grouping settings"
+msgstr ""
+
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__product_id
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__product_id
From 59af0530e6f9faaa8d8a503d5cf957369bee749a Mon Sep 17 00:00:00 2001
From: oca-git-bot
Date: Thu, 31 Mar 2022 17:18:42 +0200
Subject: [PATCH 054/210] [IMP] update dotfiles [ci skip]
---
purchase_work_acceptance/models/work_acceptance.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/models/work_acceptance.py b/purchase_work_acceptance/models/work_acceptance.py
index bef3b37c987..148dfcefbdc 100644
--- a/purchase_work_acceptance/models/work_acceptance.py
+++ b/purchase_work_acceptance/models/work_acceptance.py
@@ -142,7 +142,7 @@ def _unlink_zero_quantity(self):
wa_line_zero_quantity.unlink()
def _get_valid_wa(self, doctype, order_id):
- """ Get unused WA when validate invoice or picking """
+ """Get unused WA when validate invoice or picking"""
order = self.env["purchase.order"].browse(order_id)
all_wa = self.env["work.acceptance"].search(
[
From 4cda946611d3f902d0f1fa6998e854aacb6f48b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?N=C3=BAria=20Sancho?=
Date: Tue, 6 Sep 2022 12:31:52 +0200
Subject: [PATCH 055/210] [MIG] purchase_work_acceptance: Migration to 15.0
---
purchase_work_acceptance/__manifest__.py | 2 +-
.../data/work_acceptance_sequence.xml | 18 ++++++++----------
.../models/work_acceptance.py | 2 +-
.../tests/test_purchase_work_acceptance.py | 4 ++--
.../views/work_acceptance_views.xml | 10 +++++-----
5 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index e26f958c667..9e64b42caee 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Work Acceptance",
- "version": "14.0.1.2.0",
+ "version": "15.0.1.0.0",
"category": "Purchase Management",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
diff --git a/purchase_work_acceptance/data/work_acceptance_sequence.xml b/purchase_work_acceptance/data/work_acceptance_sequence.xml
index 0fa20f65037..86975fbc0cf 100644
--- a/purchase_work_acceptance/data/work_acceptance_sequence.xml
+++ b/purchase_work_acceptance/data/work_acceptance_sequence.xml
@@ -1,12 +1,10 @@
-
-
-
- Work Acceptance
- work.acceptance
- WA
- 5
-
-
-
+
+
+ Work Acceptance
+ work.acceptance
+ WA
+ 5
+
+
diff --git a/purchase_work_acceptance/models/work_acceptance.py b/purchase_work_acceptance/models/work_acceptance.py
index 148dfcefbdc..a8c2fcb159e 100644
--- a/purchase_work_acceptance/models/work_acceptance.py
+++ b/purchase_work_acceptance/models/work_acceptance.py
@@ -67,7 +67,7 @@ class WorkAcceptance(models.Model):
inverse_name="wa_id",
string="Work Acceptance Lines",
)
- notes = fields.Text(string="Notes")
+ notes = fields.Text()
product_id = fields.Many2one(
comodel_name="product.product",
related="wa_line_ids.product_id",
diff --git a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
index 6aa521f3bc7..41bb28398a8 100644
--- a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
+++ b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
@@ -148,7 +148,7 @@ def test_01_action_view_wa(self):
res = purchase_order.with_context(create_wa=True).action_view_wa()
ctx = res.get("context")
- work_acceptance = Form(self.env["work.acceptance"].with_context(ctx))
+ work_acceptance = Form(self.env["work.acceptance"].with_context(**ctx))
self.assertEqual(work_acceptance.state, "draft")
def test_02_flow_product(self):
@@ -157,7 +157,7 @@ def test_02_flow_product(self):
purchase_order = self._create_purchase_order(qty, self.product_product)
purchase_order.button_confirm()
self.assertEqual(purchase_order.state, "purchase")
- self.assertEqual(purchase_order.picking_count, 1)
+ self.assertEqual(purchase_order.incoming_picking_count, 1)
# Create Work Acceptance
work_acceptance = self._create_work_acceptance(qty, purchase_order)
work_acceptance.button_accept()
diff --git a/purchase_work_acceptance/views/work_acceptance_views.xml b/purchase_work_acceptance/views/work_acceptance_views.xml
index f1fd1c26028..78e10c54519 100644
--- a/purchase_work_acceptance/views/work_acceptance_views.xml
+++ b/purchase_work_acceptance/views/work_acceptance_views.xml
@@ -4,7 +4,7 @@
work.acceptance.form
work.acceptance
-
+
-
+
-
+
@@ -133,7 +133,7 @@
work.acceptance.tree
work.acceptance
-
+
@@ -159,7 +159,7 @@
work.acceptance.search
work.acceptance
-
+
From 8233a9c848a8ad6a1034edac9eb9b1073c3730b0 Mon Sep 17 00:00:00 2001
From: Saran440
Date: Thu, 1 Dec 2022 13:19:48 +0700
Subject: [PATCH 056/210] [IMP] purchase_work_acceptance: Improve test script &
cover bypass case
---
.../models/stock_picking.py | 1 +
.../tests/test_purchase_work_acceptance.py | 56 +++++++++++++++++++
2 files changed, 57 insertions(+)
diff --git a/purchase_work_acceptance/models/stock_picking.py b/purchase_work_acceptance/models/stock_picking.py
index 589294df1ec..dea98ba058a 100644
--- a/purchase_work_acceptance/models/stock_picking.py
+++ b/purchase_work_acceptance/models/stock_picking.py
@@ -20,6 +20,7 @@ class Picking(models.Model):
compute="_compute_wa_ids",
)
+ @api.depends("picking_type_id")
def _compute_require_wa(self):
for rec in self:
if rec.picking_type_id.bypass_wa:
diff --git a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
index 41bb28398a8..1111f3ef9ad 100644
--- a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
+++ b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
@@ -1,6 +1,8 @@
# Copyright 2019 Ecosoft Co., Ltd. (http://ecosoft.co.th)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+import ast
+
from odoo import fields
from odoo.exceptions import UserError, ValidationError
from odoo.tests.common import Form, TransactionCase
@@ -21,6 +23,15 @@ def setUp(self):
{"group_enable_wa_on_po": True}
).execute()
+ self.picking_type_return = self.env["stock.picking.type"].search(
+ [
+ ("code", "=", "incoming"),
+ ("return_picking_type_id", "=", False),
+ ("company_id", "=", self.main_company.id),
+ ],
+ limit=1,
+ )
+
def _create_purchase_order(self, qty, product):
purchase_order = self.env["purchase.order"].create(
{
@@ -138,6 +149,21 @@ def test_00_wa_button(self):
self.assertEqual(work_acceptance.state, "cancel")
work_acceptance.button_draft()
self.assertEqual(work_acceptance.state, "draft")
+ # Test open wizard
+ wizard = self.env.ref("purchase_work_acceptance.view_work_accepted_date_wizard")
+ res = work_acceptance.with_context(manual_date_accept=True).button_accept()
+ self.assertEqual(res["res_model"], "work.accepted.date.wizard")
+ self.assertEqual(res["view_id"], wizard.id)
+ ctx = {
+ "active_ids": [work_acceptance.id],
+ "active_id": work_acceptance.id,
+ "active_model": work_acceptance._name,
+ }
+ WorkAcceptanceWizard = self.env["work.accepted.date.wizard"]
+ with Form(WorkAcceptanceWizard.with_context(**ctx)) as f:
+ f.date_accept = self.date_now
+ wa_wizard = f.save()
+ wa_wizard.button_accept()
def test_01_action_view_wa(self):
# Create Purchase Order
@@ -150,6 +176,19 @@ def test_01_action_view_wa(self):
ctx = res.get("context")
work_acceptance = Form(self.env["work.acceptance"].with_context(**ctx))
self.assertEqual(work_acceptance.state, "draft")
+ # Open with 1 WA
+ work_acceptance1 = self._create_work_acceptance(1, purchase_order)
+ res = purchase_order.action_view_wa()
+ self.assertEqual(res["res_id"], work_acceptance1.id)
+ work_acceptance1.button_accept()
+ purchase_order._compute_wa_accepted()
+ # Open with 2 WA
+ work_acceptance2 = self._create_work_acceptance(2, purchase_order)
+ purchase_order._compute_wa_ids()
+ res = purchase_order.action_view_wa()
+ res_domain = ast.literal_eval(res["domain"])
+ wa_ids = (work_acceptance1 + work_acceptance2).ids
+ self.assertEqual(res_domain[0][2], wa_ids)
def test_02_flow_product(self):
# Create Purchase Order
@@ -239,6 +278,23 @@ def test_04_enable_config_flow(self):
invoice = self.env["account.move"].browse(res["res_id"])
self.assertEqual(sum(invoice.invoice_line_ids.mapped("quantity")), qty)
+ # Create Return with required WA
+ self.env["res.config.settings"].create(
+ {"group_enforce_wa_on_in": True}
+ ).execute()
+ picking = self.env["stock.picking"].create(
+ {
+ "picking_type_id": self.picking_type_return.id,
+ "location_id": 4,
+ "location_dest_id": 8,
+ }
+ )
+ # Set bypass reutrn not required wa
+ self.assertTrue(picking.require_wa)
+ self.picking_type_return.bypass_wa = True
+ picking._compute_require_wa()
+ self.assertFalse(picking.require_wa)
+
def test_05_create_multi_lines(self):
qty = 5.0
# Create Purchase Order
From c7b3871d22e606b4fe92f26562bf703100af967d Mon Sep 17 00:00:00 2001
From: Saran440
Date: Fri, 23 Dec 2022 11:00:11 +0700
Subject: [PATCH 057/210] [REF] purchase_work_acceptance: refactor code for
test script cover case
---
purchase_work_acceptance/models/purchase.py | 28 ++++++++---------
.../models/stock_picking.py | 30 ++++++++-----------
.../tests/test_purchase_work_acceptance.py | 11 +++++--
3 files changed, 32 insertions(+), 37 deletions(-)
diff --git a/purchase_work_acceptance/models/purchase.py b/purchase_work_acceptance/models/purchase.py
index 9a1b374cf82..aa4df11246d 100644
--- a/purchase_work_acceptance/models/purchase.py
+++ b/purchase_work_acceptance/models/purchase.py
@@ -95,19 +95,15 @@ def action_create_invoice(self):
wa = self.env["work.acceptance"].browse(ctx["wa_id"])
invoice = self.env["account.move"].browse(res["res_id"])
# invoice.ref, adding "/ WA001"
- refs = []
- if invoice.ref:
- refs.append(invoice.ref)
- if wa.name:
- refs.append(wa.name)
- invoice.ref = " / ".join(refs)
+ invoice.ref = (
+ "{} / {}".format(invoice.ref, wa.name) if invoice.ref else wa.name
+ )
# invoice.payment_reference, adding "/ "
- payment_refs = []
- if invoice.payment_reference:
- payment_refs.append(invoice.payment_reference)
- if wa.invoice_ref:
- payment_refs.append(wa.invoice_ref)
- invoice.payment_reference = " / ".join(payment_refs)
+ invoice.payment_reference = (
+ "{} / {}".format(invoice.payment_reference, wa.invoice_ref)
+ if invoice.payment_reference
+ else wa.invoice_ref
+ )
return res
def _compute_wa_accepted(self):
@@ -173,14 +169,14 @@ def _prepare_account_move_line(self, move=False):
def _compute_qty_accepted(self):
for line in self:
# compute qty_accepted
- qty = 0.0
+ qty_accepted = 0.0
for wa_line in line.wa_line_ids.filtered(
lambda l: l.wa_id.state == "accept"
):
- qty += wa_line.product_uom._compute_quantity(
+ qty_accepted += wa_line.product_uom._compute_quantity(
wa_line.product_qty, line.product_uom, round=False
)
- line.qty_accepted = qty
+ line.qty_accepted = qty_accepted
# compute qty_to_accept
- line.qty_to_accept = line.product_uom_qty - line.qty_accepted
+ line.qty_to_accept = line.product_uom_qty - qty_accepted
diff --git a/purchase_work_acceptance/models/stock_picking.py b/purchase_work_acceptance/models/stock_picking.py
index dea98ba058a..a923a451177 100644
--- a/purchase_work_acceptance/models/stock_picking.py
+++ b/purchase_work_acceptance/models/stock_picking.py
@@ -25,13 +25,12 @@ def _compute_require_wa(self):
for rec in self:
if rec.picking_type_id.bypass_wa:
rec.require_wa = False
- continue
- if rec.picking_type_code == "incoming":
+ elif rec.picking_type_code == "incoming":
rec.require_wa = self.env.user.has_group(
"purchase_work_acceptance.group_enforce_wa_on_in"
)
- continue
- rec.require_wa = False
+ else:
+ rec.require_wa = False
@api.depends("require_wa")
def _compute_wa_ids(self):
@@ -62,22 +61,18 @@ def button_validate(self):
line.product_qty, line.product_id.uom_id
)
if qty > 0.0 and line.product_id.type in ["product", "consu"]:
- if line.product_id.id in wa_line.keys():
- qty_old = wa_line[line.product_id.id]
- wa_line[line.product_id.id] = qty_old + qty
- else:
- wa_line[line.product_id.id] = qty
+ wa_line[line.product_id.id] = (
+ wa_line.get(line.product_id.id, 0) + qty
+ )
move_line = {}
for move in picking.move_ids_without_package:
qty = move.product_uom._compute_quantity(
move.quantity_done, move.product_id.uom_id
)
if qty > 0.0:
- if move.product_id.id in move_line.keys():
- qty_old = move_line[move.product_id.id]
- move_line[move.product_id.id] = qty_old + qty
- else:
- move_line[move.product_id.id] = qty
+ move_line[move.product_id.id] = (
+ move_line.get(move.product_id.id, 0) + qty
+ )
if wa_line != move_line:
raise ValidationError(
_(
@@ -95,13 +90,12 @@ def _onchange_wa_id(self):
qty = line.product_uom._compute_quantity(
line.product_qty, line.product_id.uom_id
)
- if line.product_id.id in wa_line.keys():
- qty_old = wa_line[line.product_id.id]
- wa_line[line.product_id.id] = qty_old + qty
+ if line.product_id.id in wa_line:
+ wa_line[line.product_id.id] += qty
else:
wa_line[line.product_id.id] = qty
for move_line in self.move_line_ids_without_package:
- if move_line.product_id.id in wa_line.keys():
+ if move_line.product_id.id in wa_line:
qty = wa_line[move_line.product_id.id]
if move_line.product_uom_qty < qty:
move_line._origin.qty_done = move_line.product_uom_qty
diff --git a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
index 1111f3ef9ad..9ed2d9205e2 100644
--- a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
+++ b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
@@ -272,9 +272,14 @@ def test_04_enable_config_flow(self):
res = purchase_order.with_context(create_bill=True).action_create_invoice()
self.assertEqual(res.get("res_model"), "select.work.acceptance.wizard")
wizard = self.env[res.get("res_model")].create({"wa_id": work_acceptance.id})
- res = wizard.with_context(
- active_id=purchase_order.id
- ).button_create_vendor_bill()
+ wizard = wizard.with_context(active_id=purchase_order.id)
+ self.assertEqual(wizard.wa_ids, work_acceptance)
+ res = wizard.button_create_vendor_bill()
+ invoice = self.env["account.move"].browse(res["res_id"])
+ self.assertEqual(sum(invoice.invoice_line_ids.mapped("quantity")), qty)
+ # Test create wa is used
+ with self.assertRaises(ValidationError):
+ wizard.button_create_vendor_bill()
invoice = self.env["account.move"].browse(res["res_id"])
self.assertEqual(sum(invoice.invoice_line_ids.mapped("quantity")), qty)
From 0c064bbefe0b998fad18bfb4baded22c3686e2ee Mon Sep 17 00:00:00 2001
From: oca-ci
Date: Thu, 2 Feb 2023 13:12:02 +0000
Subject: [PATCH 058/210] [UPD] Update purchase_work_acceptance.pot
---
.../i18n/purchase_work_acceptance.pot | 35 ++++---------------
1 file changed, 6 insertions(+), 29 deletions(-)
diff --git a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
index df267a3a262..4bab597ef14 100644
--- a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
+++ b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 14.0\n"
+"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -165,13 +165,7 @@ msgid "Description"
msgstr ""
#. module: purchase_work_acceptance
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_move__display_name
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order__display_name
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order_line__display_name
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_res_config_settings__display_name
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard__display_name
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_stock_picking__display_name
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_stock_picking_type__display_name
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__display_name
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__display_name
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_accepted_date_wizard__display_name
@@ -226,11 +220,6 @@ msgstr ""
msgid "Followers"
msgstr ""
-#. module: purchase_work_acceptance
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_channel_ids
-msgid "Followers (Channels)"
-msgstr ""
-
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__message_partner_ids
msgid "Followers (Partners)"
@@ -247,13 +236,12 @@ msgid "Group By"
msgstr ""
#. module: purchase_work_acceptance
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_move__id
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order__id
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order_line__id
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_res_config_settings__id
+#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__has_message
+msgid "Has Message"
+msgstr ""
+
+#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard__id
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_stock_picking__id
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_stock_picking_type__id
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__id
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__id
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_accepted_date_wizard__id
@@ -298,13 +286,7 @@ msgid "Journal Entry"
msgstr ""
#. module: purchase_work_acceptance
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_move____last_update
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order____last_update
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order_line____last_update
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_res_config_settings____last_update
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard____last_update
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_stock_picking____last_update
-#: model:ir.model.fields,field_description:purchase_work_acceptance.field_stock_picking_type____last_update
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance____last_update
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line____last_update
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_accepted_date_wizard____last_update
@@ -681,21 +663,16 @@ msgstr ""
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_select_work_acceptance_wizard__wa_id
#: model:ir.ui.menu,name:purchase_work_acceptance.menu_work_acceptance
#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.res_config_settings_view_form_purchase
-#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_form
-#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_search
-#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_tree
msgid "Work Acceptance"
msgstr ""
#. module: purchase_work_acceptance
#: model:ir.model,name:purchase_work_acceptance.model_work_acceptance_line
-#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_form
msgid "Work Acceptance Line"
msgstr ""
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance__wa_line_ids
-#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_work_acceptance_form
msgid "Work Acceptance Lines"
msgstr ""
From 3874a93f5428690c91e8b0bb016757cefc7e79a4 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Thu, 2 Feb 2023 13:19:04 +0000
Subject: [PATCH 059/210] [UPD] README.rst
---
purchase_work_acceptance/README.rst | 10 +++++-----
purchase_work_acceptance/static/description/index.html | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/purchase_work_acceptance/README.rst b/purchase_work_acceptance/README.rst
index 6218ce40939..3ea9c301f5d 100644
--- a/purchase_work_acceptance/README.rst
+++ b/purchase_work_acceptance/README.rst
@@ -14,13 +14,13 @@ Purchase Work Acceptance
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
- :target: https://github.com/OCA/purchase-workflow/tree/14.0/purchase_work_acceptance
+ :target: https://github.com/OCA/purchase-workflow/tree/15.0/purchase_work_acceptance
:alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_work_acceptance
+ :target: https://translation.odoo-community.org/projects/purchase-workflow-15-0/purchase-workflow-15-0-purchase_work_acceptance
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/142/14.0
+ :target: https://runbot.odoo-community.org/runbot/142/15.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -110,7 +110,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -150,6 +150,6 @@ Current `maintainer `__:
|maintainer-ps-tubtim|
-This module is part of the `OCA/purchase-workflow `_ project on GitHub.
+This module is part of the `OCA/purchase-workflow `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/purchase_work_acceptance/static/description/index.html b/purchase_work_acceptance/static/description/index.html
index 7e99959b2f1..b12c193679d 100644
--- a/purchase_work_acceptance/static/description/index.html
+++ b/purchase_work_acceptance/static/description/index.html
@@ -367,7 +367,7 @@ Purchase Work Acceptance
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
This module introduces the ability to define a quantity control point on Receipts and Vendor Bills by
Work Acceptance. Only the products and services that have been included in a Work Acceptance can be
received and/or invoiced.
@@ -461,7 +461,7 @@
Bugs are tracked on GitHub Issues .
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback .
+feedback .
Do not contact contributors directly about support or help with technical issues.
From fd38246fa1fbbe958cf44ebe73df5f058bb9a648 Mon Sep 17 00:00:00 2001
From: Saran440
Date: Mon, 13 Feb 2023 09:48:40 +0700
Subject: [PATCH 060/210] [FIX] hook function create_invoice
---
.../wizard/select_work_acceptance_wizard.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
index ba89d3d59d4..3687bc77cf2 100644
--- a/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
+++ b/purchase_work_acceptance/wizard/select_work_acceptance_wizard.py
@@ -32,6 +32,13 @@ def _compute_wa_ids(self):
"invoice", self.env.context.get("active_id")
)
+ def _get_purchase_order_with_context(self, order_id):
+ return (
+ self.env["purchase.order"]
+ .browse(order_id)
+ .with_context(create_bill=False, wa_id=self.wa_id.id)
+ )
+
def button_create_vendor_bill(self):
self.ensure_one()
order_id = self._context.get("active_id")
@@ -40,9 +47,5 @@ def button_create_vendor_bill(self):
raise ValidationError(
_("%s was already used by some bill") % self.wa_id.name
)
- order = self.env["purchase.order"].browse(order_id)
- return (
- order.with_context(create_bill=False, wa_id=self.wa_id.id)
- .sudo()
- .action_create_invoice()
- )
+ order = self._get_purchase_order_with_context(order_id)
+ return order.sudo().action_create_invoice()
From e6f38c2eacf6ee5b2f5e4988dad2344cd20baf5b Mon Sep 17 00:00:00 2001
From: Saran440
Date: Fri, 17 Mar 2023 11:04:11 +0700
Subject: [PATCH 061/210] [IMP] purchase_work_acceptance: add purchase in wa
view
---
purchase_work_acceptance/views/work_acceptance_views.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/purchase_work_acceptance/views/work_acceptance_views.xml b/purchase_work_acceptance/views/work_acceptance_views.xml
index 78e10c54519..c8beb7f8214 100644
--- a/purchase_work_acceptance/views/work_acceptance_views.xml
+++ b/purchase_work_acceptance/views/work_acceptance_views.xml
@@ -43,6 +43,7 @@
+
Date: Tue, 18 Apr 2023 11:06:08 +0000
Subject: [PATCH 062/210] purchase_work_acceptance 15.0.1.0.1
---
purchase_work_acceptance/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index 9e64b42caee..f0675a7a14b 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Work Acceptance",
- "version": "15.0.1.0.0",
+ "version": "15.0.1.0.1",
"category": "Purchase Management",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
From 55914e643d77cfe2973cc4daffd4892302e480eb Mon Sep 17 00:00:00 2001
From: Saran440
Date: Wed, 12 Apr 2023 13:54:08 +0700
Subject: [PATCH 063/210] [ENH] purchase_work_acceptance: compute search
wa_acceted field for filter
---
purchase_work_acceptance/models/purchase.py | 14 +++++-
.../tests/test_purchase_work_acceptance.py | 5 +++
.../views/purchase_views.xml | 44 ++++++++++++++++++-
3 files changed, 61 insertions(+), 2 deletions(-)
diff --git a/purchase_work_acceptance/models/purchase.py b/purchase_work_acceptance/models/purchase.py
index aa4df11246d..9ac59c32320 100644
--- a/purchase_work_acceptance/models/purchase.py
+++ b/purchase_work_acceptance/models/purchase.py
@@ -2,6 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
+from odoo.exceptions import UserError
class PurchaseOrder(models.Model):
@@ -19,7 +20,11 @@ class PurchaseOrder(models.Model):
string="WA Lines",
readonly=True,
)
- wa_accepted = fields.Boolean(string="WA Accepted", compute="_compute_wa_accepted")
+ wa_accepted = fields.Boolean(
+ string="WA Accepted",
+ compute="_compute_wa_accepted",
+ search="_search_wa_accepted",
+ )
def _compute_wa_ids(self):
for order in self:
@@ -113,6 +118,13 @@ def _compute_wa_accepted(self):
)
order.wa_accepted = not any(lines)
+ @api.model
+ def _search_wa_accepted(self, operator, value):
+ if operator not in ["=", "!="] or not isinstance(value, bool):
+ raise UserError(_("Operation not supported"))
+ recs = self.search([]).filtered(lambda l: l.wa_accepted is value)
+ return [("id", "in", recs.ids)]
+
def _prepare_invoice(self):
invoice_vals = super()._prepare_invoice()
invoice_vals["wa_id"] = self.env.context.get("wa_id")
diff --git a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
index 9ed2d9205e2..a6686f0b93a 100644
--- a/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
+++ b/purchase_work_acceptance/tests/test_purchase_work_acceptance.py
@@ -352,3 +352,8 @@ def test_07_hide_wa_button(self):
work_acceptance.button_accept()
purchase_order._compute_wa_accepted()
self.assertEqual(purchase_order.wa_accepted, True)
+ # Search wa accepted
+ purchase_order._search_wa_accepted("=", True)
+ # Search with not `=` or `!=`
+ with self.assertRaises(UserError):
+ purchase_order._search_wa_accepted(">", True)
diff --git a/purchase_work_acceptance/views/purchase_views.xml b/purchase_work_acceptance/views/purchase_views.xml
index 3a48fa6cc4f..8d245f906d5 100644
--- a/purchase_work_acceptance/views/purchase_views.xml
+++ b/purchase_work_acceptance/views/purchase_views.xml
@@ -1,6 +1,48 @@
-
+
+
+ request.quotation.select
+ purchase.order
+
+
+
+
+
+
+
+
+
+
+
+ purchase.order.select
+ purchase.order
+
+
+
+
+
+
+
+
+
+
purchase.order.form.inherit
purchase.order
From d029790ffe59b38a9208c03de7de3ab5fe25cf10 Mon Sep 17 00:00:00 2001
From: Saran440
Date: Fri, 28 Apr 2023 10:21:25 +0700
Subject: [PATCH 064/210] [FIX] purchase_work_acceptance: show invoice ref in
WA tree view
---
purchase_work_acceptance/views/work_acceptance_views.xml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/purchase_work_acceptance/views/work_acceptance_views.xml b/purchase_work_acceptance/views/work_acceptance_views.xml
index c8beb7f8214..5d6dcc89589 100644
--- a/purchase_work_acceptance/views/work_acceptance_views.xml
+++ b/purchase_work_acceptance/views/work_acceptance_views.xml
@@ -141,6 +141,7 @@
+
+
From 464b37a79990d5d3b587858218d3cb908aed4a8c Mon Sep 17 00:00:00 2001
From: oca-ci
Date: Mon, 5 Jun 2023 15:01:41 +0000
Subject: [PATCH 065/210] [UPD] Update purchase_work_acceptance.pot
---
.../i18n/purchase_work_acceptance.pot | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
index 4bab597ef14..bdfacb36f85 100644
--- a/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
+++ b/purchase_work_acceptance/i18n/purchase_work_acceptance.pot
@@ -384,6 +384,12 @@ msgstr ""
msgid "Number of unread messages"
msgstr ""
+#. module: purchase_work_acceptance
+#: code:addons/purchase_work_acceptance/models/purchase.py:0
+#, python-format
+msgid "Operation not supported"
+msgstr ""
+
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_work_acceptance_line__partner_id
msgid "Partner"
@@ -607,6 +613,8 @@ msgstr ""
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_purchase_order__wa_accepted
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.purchase_order_view_search
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_purchase_order_filter
msgid "WA Accepted"
msgstr ""
@@ -616,6 +624,12 @@ msgstr ""
msgid "WA Lines"
msgstr ""
+#. module: purchase_work_acceptance
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.purchase_order_view_search
+#: model_terms:ir.ui.view,arch_db:purchase_work_acceptance.view_purchase_order_filter
+msgid "WA Not Accepted"
+msgstr ""
+
#. module: purchase_work_acceptance
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_bank_statement_line__wa_id
#: model:ir.model.fields,field_description:purchase_work_acceptance.field_account_move__wa_id
From 1708c8b77f1148b47c6013dd12971bdee1110021 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Mon, 5 Jun 2023 15:10:07 +0000
Subject: [PATCH 066/210] purchase_work_acceptance 15.0.1.1.0
---
purchase_work_acceptance/__manifest__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/purchase_work_acceptance/__manifest__.py b/purchase_work_acceptance/__manifest__.py
index f0675a7a14b..bea0572b863 100644
--- a/purchase_work_acceptance/__manifest__.py
+++ b/purchase_work_acceptance/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Work Acceptance",
- "version": "15.0.1.0.1",
+ "version": "15.0.1.1.0",
"category": "Purchase Management",
"author": "Ecosoft, Odoo Community Association (OCA)",
"license": "AGPL-3",
From 8d132c9dc59b39f8e179923cde0d9c93b1b80632 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Sun, 3 Sep 2023 15:46:12 +0000
Subject: [PATCH 067/210] [UPD] README.rst
---
purchase_work_acceptance/README.rst | 15 ++++---
.../static/description/index.html | 44 ++++++++++---------
2 files changed, 32 insertions(+), 27 deletions(-)
diff --git a/purchase_work_acceptance/README.rst b/purchase_work_acceptance/README.rst
index 3ea9c301f5d..4a17079675d 100644
--- a/purchase_work_acceptance/README.rst
+++ b/purchase_work_acceptance/README.rst
@@ -2,10 +2,13 @@
Purchase Work Acceptance
========================
-.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+..
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ !! source digest: sha256:1ce800fe59b40b1f33a33e12ed713848d5d0638f103c27afa2ad2c11c415b2ee
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
@@ -19,11 +22,11 @@ Purchase Work Acceptance
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/purchase-workflow-15-0/purchase-workflow-15-0-purchase_work_acceptance
:alt: Translate me on Weblate
-.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/142/15.0
- :alt: Try me on Runbot
+.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=15.0
+ :alt: Try me on Runboat
-|badge1| |badge2| |badge3| |badge4| |badge5|
+|badge1| |badge2| |badge3| |badge4| |badge5|
This module introduces the ability to define a quantity control point on Receipts and Vendor Bills by
Work Acceptance. Only the products and services that have been included in a Work Acceptance can be
@@ -109,7 +112,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
-If you spotted it first, help us smashing it by providing a detailed and welcomed
+If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback `_.
Do not contact contributors directly about support or help with technical issues.
diff --git a/purchase_work_acceptance/static/description/index.html b/purchase_work_acceptance/static/description/index.html
index b12c193679d..1cafbc511ab 100644
--- a/purchase_work_acceptance/static/description/index.html
+++ b/purchase_work_acceptance/static/description/index.html
@@ -1,20 +1,20 @@
-
+
-
+
Purchase Work Acceptance
+
+
+
+
Purchase stock price unit sync
+
+
+
+
This module allows to sync picking cost prices with purchase order line
+price when moves are already done.
+
Can be used with product_cost_price_avco_sync.
+
Table of contents
+
+
+
+
Bugs are tracked on GitHub Issues .
+In case of trouble, please check there if your issue has already been reported.
+If you spotted it first, help us smashing it by providing a detailed and welcomed
+feedback .
+
Do not contact contributors directly about support or help with technical issues.
+
+
+
+
+
+
+
+
This module is maintained by the OCA.
+
+
OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
+
This module is part of the OCA/purchase-workflow project on GitHub.
+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute .
+
+
+
+
+
diff --git a/purchase_stock_price_unit_sync/tests/__init__.py b/purchase_stock_price_unit_sync/tests/__init__.py
new file mode 100644
index 00000000000..40febbe558a
--- /dev/null
+++ b/purchase_stock_price_unit_sync/tests/__init__.py
@@ -0,0 +1,3 @@
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+
+from . import test_purchase_stock_price_unit_sync
diff --git a/purchase_stock_price_unit_sync/tests/test_purchase_stock_price_unit_sync.py b/purchase_stock_price_unit_sync/tests/test_purchase_stock_price_unit_sync.py
new file mode 100644
index 00000000000..d74ed924e79
--- /dev/null
+++ b/purchase_stock_price_unit_sync/tests/test_purchase_stock_price_unit_sync.py
@@ -0,0 +1,46 @@
+# Copyright 2019 Tecnativa - Carlos Dauden
+# Copyright 2019 Tecnativa - Sergio Teruel
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+from odoo import fields
+from odoo.tests.common import SavepointCase
+
+
+class TestProductCostPriceAvcoSync(SavepointCase):
+
+ @classmethod
+ def setUpClass(cls):
+ super(TestProductCostPriceAvcoSync, cls).setUpClass()
+ cls.partner = cls.env['res.partner'].create({
+ 'customer': True,
+ 'supplier': True,
+ 'name': 'Test Partner',
+ })
+ cls.product = cls.env['product.product'].create({
+ 'name': 'Product for test',
+ 'type': 'product',
+ 'tracking': 'none',
+ 'property_cost_method': 'average',
+ 'standard_price': 7.0,
+ })
+
+ cls.order = cls.env['purchase.order'].create(
+ {'partner_id': cls.partner.id,
+ 'order_line': [
+ (0, 0, {
+ 'name': 'Test line',
+ 'product_qty': 10.0,
+ 'product_id': cls.product.id,
+ 'product_uom': cls.product.uom_id.id,
+ 'date_planned': fields.Date.today(),
+ 'price_unit': 8.0}),
+ ]})
+
+ def test_sync_cost_price(self):
+ self.order.button_confirm()
+ picking = self.order.picking_ids[:1]
+ move = picking.move_lines[:1]
+ move.quantity_done = move.product_uom_qty
+ picking.action_done()
+ self.assertAlmostEqual(move.price_unit, 8.0, 2)
+ self.order.order_line[:1].price_unit = 6.0
+ self.assertAlmostEqual(move.price_unit, 6.0, 2)
From 4198dd9a516ea6f090a737c4407da1061ca37e2a Mon Sep 17 00:00:00 2001
From: Carlos Dauden
Date: Thu, 9 Jan 2020 10:31:27 +0100
Subject: [PATCH 076/210] [MIG] purchase_stock_price_unit_sync: Migration to
12.0
[UPD] Update purchase_stock_price_unit_sync.pot
---
purchase_stock_price_unit_sync/README.rst | 10 +++++-----
purchase_stock_price_unit_sync/__manifest__.py | 4 ++--
.../i18n/purchase_stock_price_unit_sync.pot | 2 +-
.../static/description/index.html | 6 +++---
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/purchase_stock_price_unit_sync/README.rst b/purchase_stock_price_unit_sync/README.rst
index d96ade7b095..51447cdd2d7 100644
--- a/purchase_stock_price_unit_sync/README.rst
+++ b/purchase_stock_price_unit_sync/README.rst
@@ -14,13 +14,13 @@ Purchase stock price unit sync
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
- :target: https://github.com/OCA/purchase-workflow/tree/11.0/purchase_stock_price_unit_sync
+ :target: https://github.com/OCA/purchase-workflow/tree/12.0/purchase_stock_price_unit_sync
:alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/purchase-workflow-11-0/purchase-workflow-11-0-purchase_stock_price_unit_sync
+ :target: https://translation.odoo-community.org/projects/purchase-workflow-12-0/purchase-workflow-12-0-purchase_stock_price_unit_sync
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/142/11.0
+ :target: https://runbot.odoo-community.org/runbot/142/12.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -41,7 +41,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -74,6 +74,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-This module is part of the `OCA/purchase-workflow `_ project on GitHub.
+This module is part of the `OCA/purchase-workflow `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/purchase_stock_price_unit_sync/__manifest__.py b/purchase_stock_price_unit_sync/__manifest__.py
index a093a60f1eb..f6784a71638 100644
--- a/purchase_stock_price_unit_sync/__manifest__.py
+++ b/purchase_stock_price_unit_sync/__manifest__.py
@@ -4,13 +4,13 @@
{
'name': 'Purchase stock price unit sync',
'summary': 'Update cost price in stock moves already done',
- 'version': '11.0.1.0.0',
+ 'version': '12.0.1.0.0',
'category': 'Purchase',
'website': 'https://github.com/OCA/purchase-workflow',
'author': 'Tecnativa, Odoo Community Association (OCA)',
'license': 'AGPL-3',
'installable': True,
'depends': [
- 'purchase',
+ 'purchase_stock',
],
}
diff --git a/purchase_stock_price_unit_sync/i18n/purchase_stock_price_unit_sync.pot b/purchase_stock_price_unit_sync/i18n/purchase_stock_price_unit_sync.pot
index 676a9476da2..16a9b9ac8e1 100644
--- a/purchase_stock_price_unit_sync/i18n/purchase_stock_price_unit_sync.pot
+++ b/purchase_stock_price_unit_sync/i18n/purchase_stock_price_unit_sync.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 11.0\n"
+"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
diff --git a/purchase_stock_price_unit_sync/static/description/index.html b/purchase_stock_price_unit_sync/static/description/index.html
index 06960d26983..6fcf636c185 100644
--- a/purchase_stock_price_unit_sync/static/description/index.html
+++ b/purchase_stock_price_unit_sync/static/description/index.html
@@ -367,7 +367,7 @@ Purchase stock price unit sync
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
This module allows to sync picking cost prices with purchase order line
price when moves are already done.
Can be used with product_cost_price_avco_sync.
@@ -388,7 +388,7 @@
Bugs are tracked on GitHub Issues .
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback .
+feedback .
Do not contact contributors directly about support or help with technical issues.
@@ -419,7 +419,7 @@
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-
This module is part of the OCA/purchase-workflow project on GitHub.
+
This module is part of the OCA/purchase-workflow project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute .
From c79bb45f4d51fcf6b55e49c4dc9b0fd9f41d2fcb Mon Sep 17 00:00:00 2001
From: sergio-teruel
Date: Thu, 17 Sep 2020 16:16:45 +0200
Subject: [PATCH 077/210] [IMP] purchase_stock_price_unit_sync: black, isort
---
.../__manifest__.py | 20 +++----
.../models/purchase_order.py | 20 ++++---
.../test_purchase_stock_price_unit_sync.py | 55 +++++++++++--------
3 files changed, 52 insertions(+), 43 deletions(-)
diff --git a/purchase_stock_price_unit_sync/__manifest__.py b/purchase_stock_price_unit_sync/__manifest__.py
index f6784a71638..1b1bfa81c41 100644
--- a/purchase_stock_price_unit_sync/__manifest__.py
+++ b/purchase_stock_price_unit_sync/__manifest__.py
@@ -2,15 +2,13 @@
# Copyright 2018 Tecnativa - Sergio Teruel
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
- 'name': 'Purchase stock price unit sync',
- 'summary': 'Update cost price in stock moves already done',
- 'version': '12.0.1.0.0',
- 'category': 'Purchase',
- 'website': 'https://github.com/OCA/purchase-workflow',
- 'author': 'Tecnativa, Odoo Community Association (OCA)',
- 'license': 'AGPL-3',
- 'installable': True,
- 'depends': [
- 'purchase_stock',
- ],
+ "name": "Purchase stock price unit sync",
+ "summary": "Update cost price in stock moves already done",
+ "version": "12.0.1.0.0",
+ "category": "Purchase",
+ "website": "https://github.com/OCA/purchase-workflow",
+ "author": "Tecnativa, Odoo Community Association (OCA)",
+ "license": "AGPL-3",
+ "installable": True,
+ "depends": ["purchase_stock",],
}
diff --git a/purchase_stock_price_unit_sync/models/purchase_order.py b/purchase_stock_price_unit_sync/models/purchase_order.py
index 6c53c4fbeef..ed77ba22fa1 100644
--- a/purchase_stock_price_unit_sync/models/purchase_order.py
+++ b/purchase_stock_price_unit_sync/models/purchase_order.py
@@ -5,18 +5,22 @@
class PurchaseOrderLine(models.Model):
- _inherit = 'purchase.order.line'
+ _inherit = "purchase.order.line"
def write(self, vals):
res = super().write(vals)
- if ('price_unit' in vals or 'discount' in vals) and (
- not self.env.context.get('skip_stock_price_unit_sync')):
+ if ("price_unit" in vals or "discount" in vals) and (
+ not self.env.context.get("skip_stock_price_unit_sync")
+ ):
self.stock_price_unit_sync()
return res
def stock_price_unit_sync(self):
- for line in self.filtered(lambda l: l.state in ['purchase', 'done']):
- line.move_ids.write({
- 'price_unit': line.with_context(skip_stock_price_unit_sync=True
- )._get_stock_move_price_unit(),
- })
+ for line in self.filtered(lambda l: l.state in ["purchase", "done"]):
+ line.move_ids.write(
+ {
+ "price_unit": line.with_context(
+ skip_stock_price_unit_sync=True
+ )._get_stock_move_price_unit(),
+ }
+ )
diff --git a/purchase_stock_price_unit_sync/tests/test_purchase_stock_price_unit_sync.py b/purchase_stock_price_unit_sync/tests/test_purchase_stock_price_unit_sync.py
index d74ed924e79..e1d292bebb8 100644
--- a/purchase_stock_price_unit_sync/tests/test_purchase_stock_price_unit_sync.py
+++ b/purchase_stock_price_unit_sync/tests/test_purchase_stock_price_unit_sync.py
@@ -6,34 +6,41 @@
class TestProductCostPriceAvcoSync(SavepointCase):
-
@classmethod
def setUpClass(cls):
super(TestProductCostPriceAvcoSync, cls).setUpClass()
- cls.partner = cls.env['res.partner'].create({
- 'customer': True,
- 'supplier': True,
- 'name': 'Test Partner',
- })
- cls.product = cls.env['product.product'].create({
- 'name': 'Product for test',
- 'type': 'product',
- 'tracking': 'none',
- 'property_cost_method': 'average',
- 'standard_price': 7.0,
- })
+ cls.partner = cls.env["res.partner"].create(
+ {"customer": True, "supplier": True, "name": "Test Partner",}
+ )
+ cls.product = cls.env["product.product"].create(
+ {
+ "name": "Product for test",
+ "type": "product",
+ "tracking": "none",
+ "property_cost_method": "average",
+ "standard_price": 7.0,
+ }
+ )
- cls.order = cls.env['purchase.order'].create(
- {'partner_id': cls.partner.id,
- 'order_line': [
- (0, 0, {
- 'name': 'Test line',
- 'product_qty': 10.0,
- 'product_id': cls.product.id,
- 'product_uom': cls.product.uom_id.id,
- 'date_planned': fields.Date.today(),
- 'price_unit': 8.0}),
- ]})
+ cls.order = cls.env["purchase.order"].create(
+ {
+ "partner_id": cls.partner.id,
+ "order_line": [
+ (
+ 0,
+ 0,
+ {
+ "name": "Test line",
+ "product_qty": 10.0,
+ "product_id": cls.product.id,
+ "product_uom": cls.product.uom_id.id,
+ "date_planned": fields.Date.today(),
+ "price_unit": 8.0,
+ },
+ ),
+ ],
+ }
+ )
def test_sync_cost_price(self):
self.order.button_confirm()
From d754db7ec909fb0d4eae7488f1933a36471b7798 Mon Sep 17 00:00:00 2001
From: sergio-teruel
Date: Thu, 17 Sep 2020 16:16:46 +0200
Subject: [PATCH 078/210] [MIG] purchase_stock_price_unit_sync: Migration to
v13.0
[UPD] Update purchase_stock_price_unit_sync.pot
---
purchase_stock_price_unit_sync/README.rst | 10 +++++-----
purchase_stock_price_unit_sync/__manifest__.py | 4 ++--
.../i18n/purchase_stock_price_unit_sync.pot | 7 +++----
.../models/purchase_order.py | 4 ++--
.../static/description/index.html | 6 +++---
.../tests/test_purchase_stock_price_unit_sync.py | 16 ++++++++++------
6 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/purchase_stock_price_unit_sync/README.rst b/purchase_stock_price_unit_sync/README.rst
index 51447cdd2d7..cb64d0109e5 100644
--- a/purchase_stock_price_unit_sync/README.rst
+++ b/purchase_stock_price_unit_sync/README.rst
@@ -14,13 +14,13 @@ Purchase stock price unit sync
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
- :target: https://github.com/OCA/purchase-workflow/tree/12.0/purchase_stock_price_unit_sync
+ :target: https://github.com/OCA/purchase-workflow/tree/13.0/purchase_stock_price_unit_sync
:alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/purchase-workflow-12-0/purchase-workflow-12-0-purchase_stock_price_unit_sync
+ :target: https://translation.odoo-community.org/projects/purchase-workflow-13-0/purchase-workflow-13-0-purchase_stock_price_unit_sync
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/142/12.0
+ :target: https://runbot.odoo-community.org/runbot/142/13.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -41,7 +41,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -74,6 +74,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-This module is part of the `OCA/purchase-workflow `_ project on GitHub.
+This module is part of the `OCA/purchase-workflow `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/purchase_stock_price_unit_sync/__manifest__.py b/purchase_stock_price_unit_sync/__manifest__.py
index 1b1bfa81c41..a4895b56906 100644
--- a/purchase_stock_price_unit_sync/__manifest__.py
+++ b/purchase_stock_price_unit_sync/__manifest__.py
@@ -4,11 +4,11 @@
{
"name": "Purchase stock price unit sync",
"summary": "Update cost price in stock moves already done",
- "version": "12.0.1.0.0",
+ "version": "13.0.1.0.0",
"category": "Purchase",
"website": "https://github.com/OCA/purchase-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"installable": True,
- "depends": ["purchase_stock",],
+ "depends": ["purchase_stock"],
}
diff --git a/purchase_stock_price_unit_sync/i18n/purchase_stock_price_unit_sync.pot b/purchase_stock_price_unit_sync/i18n/purchase_stock_price_unit_sync.pot
index 16a9b9ac8e1..7cb3c725358 100644
--- a/purchase_stock_price_unit_sync/i18n/purchase_stock_price_unit_sync.pot
+++ b/purchase_stock_price_unit_sync/i18n/purchase_stock_price_unit_sync.pot
@@ -1,12 +1,12 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
-# * purchase_stock_price_unit_sync
+# * purchase_stock_price_unit_sync
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 12.0\n"
+"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: <>\n"
+"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -17,4 +17,3 @@ msgstr ""
#: model:ir.model,name:purchase_stock_price_unit_sync.model_purchase_order_line
msgid "Purchase Order Line"
msgstr ""
-
diff --git a/purchase_stock_price_unit_sync/models/purchase_order.py b/purchase_stock_price_unit_sync/models/purchase_order.py
index ed77ba22fa1..756a175428c 100644
--- a/purchase_stock_price_unit_sync/models/purchase_order.py
+++ b/purchase_stock_price_unit_sync/models/purchase_order.py
@@ -17,9 +17,9 @@ def write(self, vals):
def stock_price_unit_sync(self):
for line in self.filtered(lambda l: l.state in ["purchase", "done"]):
- line.move_ids.write(
+ line.move_ids.mapped("stock_valuation_layer_ids").write(
{
- "price_unit": line.with_context(
+ "unit_cost": line.with_context(
skip_stock_price_unit_sync=True
)._get_stock_move_price_unit(),
}
diff --git a/purchase_stock_price_unit_sync/static/description/index.html b/purchase_stock_price_unit_sync/static/description/index.html
index 6fcf636c185..b3a345606e6 100644
--- a/purchase_stock_price_unit_sync/static/description/index.html
+++ b/purchase_stock_price_unit_sync/static/description/index.html
@@ -367,7 +367,7 @@ Purchase stock price unit sync
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
This module allows to sync picking cost prices with purchase order line
price when moves are already done.
Can be used with product_cost_price_avco_sync.
@@ -388,7 +388,7 @@
Bugs are tracked on GitHub Issues .
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback .
+feedback .
Do not contact contributors directly about support or help with technical issues.
@@ -419,7 +419,7 @@
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-
This module is part of the OCA/purchase-workflow project on GitHub.
+
This module is part of the OCA/purchase-workflow project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute .
diff --git a/purchase_stock_price_unit_sync/tests/test_purchase_stock_price_unit_sync.py b/purchase_stock_price_unit_sync/tests/test_purchase_stock_price_unit_sync.py
index e1d292bebb8..bbc91523913 100644
--- a/purchase_stock_price_unit_sync/tests/test_purchase_stock_price_unit_sync.py
+++ b/purchase_stock_price_unit_sync/tests/test_purchase_stock_price_unit_sync.py
@@ -9,16 +9,20 @@ class TestProductCostPriceAvcoSync(SavepointCase):
@classmethod
def setUpClass(cls):
super(TestProductCostPriceAvcoSync, cls).setUpClass()
- cls.partner = cls.env["res.partner"].create(
- {"customer": True, "supplier": True, "name": "Test Partner",}
+ cls.partner = cls.env["res.partner"].create({"name": "Test Partner"})
+ cls.product_category = cls.env["product.category"].create(
+ {
+ "name": "Category property_cost_method average",
+ "property_cost_method": "average",
+ }
)
cls.product = cls.env["product.product"].create(
{
"name": "Product for test",
"type": "product",
"tracking": "none",
- "property_cost_method": "average",
- "standard_price": 7.0,
+ "categ_id": cls.product_category.id,
+ "standard_price": 1,
}
)
@@ -48,6 +52,6 @@ def test_sync_cost_price(self):
move = picking.move_lines[:1]
move.quantity_done = move.product_uom_qty
picking.action_done()
- self.assertAlmostEqual(move.price_unit, 8.0, 2)
+ self.assertAlmostEqual(move.stock_valuation_layer_ids[:1].unit_cost, 8.0, 2)
self.order.order_line[:1].price_unit = 6.0
- self.assertAlmostEqual(move.price_unit, 6.0, 2)
+ self.assertAlmostEqual(move.stock_valuation_layer_ids[:1].unit_cost, 6.0, 2)
From 4b01dc585f06750c2d6b63db8cf6cd1b6435af1f Mon Sep 17 00:00:00 2001
From: david
Date: Thu, 14 Oct 2021 12:31:16 +0200
Subject: [PATCH 079/210] [IMP][FIX] purchase_stock_price_unit_sync: handle kit
cases
If we receive a kit, we shouldn't write the kit purchase price on the
components price units.
TT32040
purchase_stock_price_unit_sync 13.0.1.0.1
---
purchase_stock_price_unit_sync/__manifest__.py | 2 +-
.../models/purchase_order.py | 12 ++++++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/purchase_stock_price_unit_sync/__manifest__.py b/purchase_stock_price_unit_sync/__manifest__.py
index a4895b56906..7d30c01e002 100644
--- a/purchase_stock_price_unit_sync/__manifest__.py
+++ b/purchase_stock_price_unit_sync/__manifest__.py
@@ -4,7 +4,7 @@
{
"name": "Purchase stock price unit sync",
"summary": "Update cost price in stock moves already done",
- "version": "13.0.1.0.0",
+ "version": "13.0.1.0.1",
"category": "Purchase",
"website": "https://github.com/OCA/purchase-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
diff --git a/purchase_stock_price_unit_sync/models/purchase_order.py b/purchase_stock_price_unit_sync/models/purchase_order.py
index 756a175428c..e29f25f563f 100644
--- a/purchase_stock_price_unit_sync/models/purchase_order.py
+++ b/purchase_stock_price_unit_sync/models/purchase_order.py
@@ -17,6 +17,18 @@ def write(self, vals):
def stock_price_unit_sync(self):
for line in self.filtered(lambda l: l.state in ["purchase", "done"]):
+ # When the affected product is a kit we do nothing, which is the
+ # default behavior on the standard: the move is exploded into moves
+ # for the components and those get the default price_unit for the
+ # time being. We avoid a hard dependency as well.
+ if hasattr(line.product_id, "bom_ids") and self.env[
+ "mrp.bom"
+ ].sudo()._bom_find(
+ product=line.product_id,
+ company_id=line.company_id.id,
+ bom_type="phantom",
+ ):
+ continue
line.move_ids.mapped("stock_valuation_layer_ids").write(
{
"unit_cost": line.with_context(
From 4a6d692519c0f722b8b6ba88b39ebde086dfe1b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?=
Date: Wed, 9 Mar 2022 14:32:46 +0100
Subject: [PATCH 080/210] [MIG] purchase_stock_price_unit_sync: Migration to
14.0 TT35009
---
purchase_stock_price_unit_sync/README.rst | 10 +++++-----
purchase_stock_price_unit_sync/__manifest__.py | 2 +-
.../models/purchase_order.py | 2 +-
purchase_stock_price_unit_sync/readme/CONTRIBUTORS.rst | 4 ++--
.../static/description/index.html | 8 ++++----
.../tests/test_purchase_stock_price_unit_sync.py | 4 ++--
6 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/purchase_stock_price_unit_sync/README.rst b/purchase_stock_price_unit_sync/README.rst
index cb64d0109e5..3bc08d2fa08 100644
--- a/purchase_stock_price_unit_sync/README.rst
+++ b/purchase_stock_price_unit_sync/README.rst
@@ -14,13 +14,13 @@ Purchase stock price unit sync
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
- :target: https://github.com/OCA/purchase-workflow/tree/13.0/purchase_stock_price_unit_sync
+ :target: https://github.com/OCA/purchase-workflow/tree/14.0/purchase_stock_price_unit_sync
:alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/purchase-workflow-13-0/purchase-workflow-13-0-purchase_stock_price_unit_sync
+ :target: https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_stock_price_unit_sync
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/142/13.0
+ :target: https://runbot.odoo-community.org/runbot/142/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -41,7 +41,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -74,6 +74,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-This module is part of the `OCA/purchase-workflow `_ project on GitHub.
+This module is part of the `OCA/purchase-workflow `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/purchase_stock_price_unit_sync/__manifest__.py b/purchase_stock_price_unit_sync/__manifest__.py
index 7d30c01e002..92265c35096 100644
--- a/purchase_stock_price_unit_sync/__manifest__.py
+++ b/purchase_stock_price_unit_sync/__manifest__.py
@@ -4,7 +4,7 @@
{
"name": "Purchase stock price unit sync",
"summary": "Update cost price in stock moves already done",
- "version": "13.0.1.0.1",
+ "version": "14.0.1.0.0",
"category": "Purchase",
"website": "https://github.com/OCA/purchase-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
diff --git a/purchase_stock_price_unit_sync/models/purchase_order.py b/purchase_stock_price_unit_sync/models/purchase_order.py
index e29f25f563f..0fc933ee7a1 100644
--- a/purchase_stock_price_unit_sync/models/purchase_order.py
+++ b/purchase_stock_price_unit_sync/models/purchase_order.py
@@ -1,4 +1,4 @@
-# Copyright 2019 Carlos Dauden - Tecnativa
+# Copyright 2019 Tecnativa - Carlos Dauden
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models
diff --git a/purchase_stock_price_unit_sync/readme/CONTRIBUTORS.rst b/purchase_stock_price_unit_sync/readme/CONTRIBUTORS.rst
index 22e2c955617..66d11c82502 100644
--- a/purchase_stock_price_unit_sync/readme/CONTRIBUTORS.rst
+++ b/purchase_stock_price_unit_sync/readme/CONTRIBUTORS.rst
@@ -1,4 +1,4 @@
* `Tecnativa `_:
- * Carlos Dauden
- * Sergio Teruel
+ * Carlos Dauden
+ * Sergio Teruel
diff --git a/purchase_stock_price_unit_sync/static/description/index.html b/purchase_stock_price_unit_sync/static/description/index.html
index b3a345606e6..826bb972112 100644
--- a/purchase_stock_price_unit_sync/static/description/index.html
+++ b/purchase_stock_price_unit_sync/static/description/index.html
@@ -3,7 +3,7 @@
-
+
Purchase stock price unit sync
+
+
+
+
Price recalculation in purchases orders
+
+
+
+
This module adds one button on purchase orders (below the lines) that:
+
+Recalculates the prices of the order lines that contain a product in them.
+
+
It is launched manually as a button to get the user to decide if he/she wants to
+recalculate prices when vendor is changed or after duplicating a purchase order
+to update or not purchase information.
+
Table of contents
+
+
+
+
+Go to Purchase -> Products > Products and create some record and set differente prices to vendors in Purchase tab, for example: Vendor 1: 10 and Vendor 2: 20.
+Go to Purchase -> Orders > Requests for Quotation and create some record and set Vendor 1.
+Add a line with the previously created product.
+The unit price of the product is 10.
+Change vendor to Vendor 2.
+Click on the “Update lines info” button.
+The unit price of the product is 20.
+
+
+
+
+
Bugs are tracked on GitHub Issues .
+In case of trouble, please check there if your issue has already been reported.
+If you spotted it first, help us smashing it by providing a detailed and welcomed
+feedback .
+
Do not contact contributors directly about support or help with technical issues.
+
+
+
+
+
+
+
+Tecnativa :
+Víctor Martínez
+Pedro M. Baeza
+
+
+
+
+
+
+
This module is maintained by the OCA.
+
+
OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
+
Current maintainer :
+
+
This module is part of the OCA/purchase-workflow project on GitHub.
+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute .
+
+
+
+
+
diff --git a/purchase_order_price_recalculation/tests/__init__.py b/purchase_order_price_recalculation/tests/__init__.py
new file mode 100644
index 00000000000..3f6b4227301
--- /dev/null
+++ b/purchase_order_price_recalculation/tests/__init__.py
@@ -0,0 +1,2 @@
+# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
+from . import test_purchase_order_price_recalculation
diff --git a/purchase_order_price_recalculation/tests/test_purchase_order_price_recalculation.py b/purchase_order_price_recalculation/tests/test_purchase_order_price_recalculation.py
new file mode 100644
index 00000000000..93f37ac5a54
--- /dev/null
+++ b/purchase_order_price_recalculation/tests/test_purchase_order_price_recalculation.py
@@ -0,0 +1,42 @@
+# Copyright 2022 Tecnativa - Víctor Martínez
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
+
+from odoo.tests import Form, common
+
+
+class TestPurchaseOrderPriceRecalculation(common.SavepointCase):
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+ cls.partner_a = cls.env["res.partner"].create({"name": "Test partner A"})
+ cls.partner_b = cls.env["res.partner"].create({"name": "Test partner B"})
+ cls.product = cls.env["product.product"].create(
+ {
+ "name": "Test product",
+ "seller_ids": [
+ (0, 0, {"name": cls.partner_a.id, "price": 10}),
+ (0, 0, {"name": cls.partner_b.id, "price": 20}),
+ ],
+ }
+ )
+ cls.order = cls._create_order(cls, cls.partner_a)
+
+ def _create_order(self, partner):
+ order_form = Form(self.env["purchase.order"])
+ order_form.partner_id = partner
+ with order_form.order_line.new() as line_form:
+ line_form.product_id = self.product
+ line_form.product_qty = 1
+ return order_form.save()
+
+ def test_order_update_lines_info(self):
+ product_line = self.order.order_line
+ self.assertEqual(product_line.price_unit, 10)
+ # Test form
+ order_form = Form(self.order)
+ order_form.partner_id = self.partner_b
+ # Update partner
+ self.order.partner_id = self.partner_b
+ self.assertEqual(product_line.price_unit, 10)
+ self.order.update_lines_info()
+ self.assertEqual(product_line.price_unit, 20)
diff --git a/purchase_order_price_recalculation/views/purchase_order_view.xml b/purchase_order_price_recalculation/views/purchase_order_view.xml
new file mode 100644
index 00000000000..b310c841b05
--- /dev/null
+++ b/purchase_order_price_recalculation/views/purchase_order_view.xml
@@ -0,0 +1,19 @@
+
+
+
+ purchase.order
+
+
+
+
+
+
+
+
From 88148d020fe917e30a71c7647dfe72e7e77e6fbc Mon Sep 17 00:00:00 2001
From: Francesco Foresti
Date: Wed, 16 Nov 2022 17:33:19 +0000
Subject: [PATCH 112/210] Added translation using Weblate (Italian)
---
purchase_order_price_recalculation/i18n/it.po | 47 +++++++++++++++++++
1 file changed, 47 insertions(+)
create mode 100644 purchase_order_price_recalculation/i18n/it.po
diff --git a/purchase_order_price_recalculation/i18n/it.po b/purchase_order_price_recalculation/i18n/it.po
new file mode 100644
index 00000000000..e05819377e9
--- /dev/null
+++ b/purchase_order_price_recalculation/i18n/it.po
@@ -0,0 +1,47 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * purchase_order_price_recalculation
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 14.0\n"
+"Report-Msgid-Bugs-To: \n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: it\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+#. module: purchase_order_price_recalculation
+#: model:ir.model.fields,field_description:purchase_order_price_recalculation.field_purchase_order__display_name
+msgid "Display Name"
+msgstr ""
+
+#. module: purchase_order_price_recalculation
+#: model:ir.model.fields,field_description:purchase_order_price_recalculation.field_purchase_order__id
+msgid "ID"
+msgstr ""
+
+#. module: purchase_order_price_recalculation
+#: model:ir.model.fields,field_description:purchase_order_price_recalculation.field_purchase_order____last_update
+msgid "Last Modified on"
+msgstr ""
+
+#. module: purchase_order_price_recalculation
+#: model:ir.model,name:purchase_order_price_recalculation.model_purchase_order
+msgid "Purchase Order"
+msgstr ""
+
+#. module: purchase_order_price_recalculation
+#: model_terms:ir.ui.view,arch_db:purchase_order_price_recalculation.purchase_order_form
+msgid ""
+"This will update all the line prices based on the vendor currently set. Do "
+"you want to continue?"
+msgstr ""
+
+#. module: purchase_order_price_recalculation
+#: model_terms:ir.ui.view,arch_db:purchase_order_price_recalculation.purchase_order_form
+msgid "Update lines info"
+msgstr ""
From 38ec7e972efb8c82d94cd4d7d2b97181791dccc6 Mon Sep 17 00:00:00 2001
From: Francesco Foresti
Date: Wed, 16 Nov 2022 17:33:26 +0000
Subject: [PATCH 113/210] Translated using Weblate (Italian)
Currently translated at 100.0% (6 of 6 strings)
Translation: purchase-workflow-14.0/purchase-workflow-14.0-purchase_order_price_recalculation
Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_order_price_recalculation/it/
---
purchase_order_price_recalculation/i18n/it.po | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/purchase_order_price_recalculation/i18n/it.po b/purchase_order_price_recalculation/i18n/it.po
index e05819377e9..001a47c5360 100644
--- a/purchase_order_price_recalculation/i18n/it.po
+++ b/purchase_order_price_recalculation/i18n/it.po
@@ -6,33 +6,35 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
-"Last-Translator: Automatically generated\n"
+"PO-Revision-Date: 2022-11-16 19:44+0000\n"
+"Last-Translator: Francesco Foresti \n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Generator: Weblate 4.14.1\n"
#. module: purchase_order_price_recalculation
#: model:ir.model.fields,field_description:purchase_order_price_recalculation.field_purchase_order__display_name
msgid "Display Name"
-msgstr ""
+msgstr "Nome da visualizzare"
#. module: purchase_order_price_recalculation
#: model:ir.model.fields,field_description:purchase_order_price_recalculation.field_purchase_order__id
msgid "ID"
-msgstr ""
+msgstr "ID"
#. module: purchase_order_price_recalculation
#: model:ir.model.fields,field_description:purchase_order_price_recalculation.field_purchase_order____last_update
msgid "Last Modified on"
-msgstr ""
+msgstr "Ultima modifica il"
#. module: purchase_order_price_recalculation
#: model:ir.model,name:purchase_order_price_recalculation.model_purchase_order
msgid "Purchase Order"
-msgstr ""
+msgstr "Ordine di acquisto"
#. module: purchase_order_price_recalculation
#: model_terms:ir.ui.view,arch_db:purchase_order_price_recalculation.purchase_order_form
@@ -40,8 +42,10 @@ msgid ""
"This will update all the line prices based on the vendor currently set. Do "
"you want to continue?"
msgstr ""
+"Questo aggiornerà i prezzi di tutte le righe sulla base del fornitore "
+"impostato in questo momento. Vuoi continuare?"
#. module: purchase_order_price_recalculation
#: model_terms:ir.ui.view,arch_db:purchase_order_price_recalculation.purchase_order_form
msgid "Update lines info"
-msgstr ""
+msgstr "Aggiorna info righe"
From 92386bbe392febf07d25071c7e263f77b83a7d3b Mon Sep 17 00:00:00 2001
From: mymage
Date: Thu, 23 Mar 2023 10:53:45 +0000
Subject: [PATCH 114/210] Translated using Weblate (Italian)
Currently translated at 100.0% (6 of 6 strings)
Translation: purchase-workflow-14.0/purchase-workflow-14.0-purchase_order_price_recalculation
Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_order_price_recalculation/it/
[UPD] README.rst
---
purchase_order_price_recalculation/README.rst | 15 ++++---
purchase_order_price_recalculation/i18n/it.po | 6 +--
.../static/description/index.html | 40 ++++++++++---------
3 files changed, 33 insertions(+), 28 deletions(-)
diff --git a/purchase_order_price_recalculation/README.rst b/purchase_order_price_recalculation/README.rst
index b757c0d5fe4..543e78d9674 100644
--- a/purchase_order_price_recalculation/README.rst
+++ b/purchase_order_price_recalculation/README.rst
@@ -2,10 +2,13 @@
Price recalculation in purchases orders
=======================================
-.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+..
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ !! source digest: sha256:990cd9a9f28aac588b8afdc0bcfb334edc4b5e6c94c6d2a39f056f32f13cfebc
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
@@ -19,11 +22,11 @@ Price recalculation in purchases orders
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_order_price_recalculation
:alt: Translate me on Weblate
-.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/142/14.0
- :alt: Try me on Runbot
+.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=14.0
+ :alt: Try me on Runboat
-|badge1| |badge2| |badge3| |badge4| |badge5|
+|badge1| |badge2| |badge3| |badge4| |badge5|
This module adds one button on purchase orders (below the lines) that:
@@ -54,7 +57,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
-If you spotted it first, help us smashing it by providing a detailed and welcomed
+If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback `_.
Do not contact contributors directly about support or help with technical issues.
diff --git a/purchase_order_price_recalculation/i18n/it.po b/purchase_order_price_recalculation/i18n/it.po
index 001a47c5360..462dd5690bf 100644
--- a/purchase_order_price_recalculation/i18n/it.po
+++ b/purchase_order_price_recalculation/i18n/it.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
-"PO-Revision-Date: 2022-11-16 19:44+0000\n"
-"Last-Translator: Francesco Foresti \n"
+"PO-Revision-Date: 2023-03-23 13:24+0000\n"
+"Last-Translator: mymage \n"
"Language-Team: none\n"
"Language: it\n"
"MIME-Version: 1.0\n"
@@ -19,7 +19,7 @@ msgstr ""
#. module: purchase_order_price_recalculation
#: model:ir.model.fields,field_description:purchase_order_price_recalculation.field_purchase_order__display_name
msgid "Display Name"
-msgstr "Nome da visualizzare"
+msgstr "Nome visualizzato"
#. module: purchase_order_price_recalculation
#: model:ir.model.fields,field_description:purchase_order_price_recalculation.field_purchase_order__id
diff --git a/purchase_order_price_recalculation/static/description/index.html b/purchase_order_price_recalculation/static/description/index.html
index 3240b8c6639..100a763ea8d 100644
--- a/purchase_order_price_recalculation/static/description/index.html
+++ b/purchase_order_price_recalculation/static/description/index.html
@@ -1,20 +1,20 @@
-
+
-
+
Price recalculation in purchases orders
+
+
+
+
Purchase Order Product Attachment Mgmt
+
+
+
+
This module allows to get all attachments from all products of a purchase on a view.
+
Table of contents
+
+
+
+
+Go to Purchase -> Orders > Purchase Orders and create or edit some record.
+The smart-button “Attachments” display the attachments of the product lines.
+
+
+
+
+
Bugs are tracked on GitHub Issues .
+In case of trouble, please check there if your issue has already been reported.
+If you spotted it first, help us smashing it by providing a detailed and welcomed
+feedback .
+
Do not contact contributors directly about support or help with technical issues.
+
+
+
+
+
+
+
+Tecnativa :
+Víctor Martínez
+Pedro M. Baeza
+
+
+
+
+
+
+
This module is maintained by the OCA.
+
+
OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
+
Current maintainer :
+
+
This module is part of the OCA/purchase-workflow project on GitHub.
+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute .
+
+
+
+
+
diff --git a/purchase_order_product_attachment_mgmt/tests/__init__.py b/purchase_order_product_attachment_mgmt/tests/__init__.py
new file mode 100644
index 00000000000..4d931d95937
--- /dev/null
+++ b/purchase_order_product_attachment_mgmt/tests/__init__.py
@@ -0,0 +1,3 @@
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
+
+from . import test_purchase_order_product_attachment_mgmt
diff --git a/purchase_order_product_attachment_mgmt/tests/test_purchase_order_product_attachment_mgmt.py b/purchase_order_product_attachment_mgmt/tests/test_purchase_order_product_attachment_mgmt.py
new file mode 100644
index 00000000000..3c844e9a562
--- /dev/null
+++ b/purchase_order_product_attachment_mgmt/tests/test_purchase_order_product_attachment_mgmt.py
@@ -0,0 +1,48 @@
+# Copyright 2022 Tecnativa - Víctor Martínez
+# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
+import base64
+
+from odoo.tests import Form, common
+
+
+class TestPurchaseOrderProductAttachmentMgmt(common.SavepointCase):
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+ cls.partner = cls.env["res.partner"].create({"name": "Mr Odoo"})
+ cls.product_a = cls.env["product.product"].create({"name": "Test Product A"})
+ cls.product_b = cls.env["product.product"].create({"name": "Test Product B"})
+ cls.purchase_order = cls._create_purchase_order(cls)
+
+ def _create_purchase_order(self):
+ order_form = Form(self.env["purchase.order"])
+ order_form.partner_id = self.partner
+ with order_form.order_line.new() as line_form:
+ line_form.product_id = self.product_a
+ with order_form.order_line.new() as line_form:
+ line_form.product_id = self.product_b
+ return order_form.save()
+
+ def _create_attachment(self, product):
+ return self.env["ir.attachment"].create(
+ {
+ "name": "Test file %s" % product.name,
+ "res_model": product._name,
+ "res_id": product.id,
+ "datas": base64.b64encode(b"\xff data"),
+ }
+ )
+
+ def test_purchase_order_documents(self):
+ attachment_a = self._create_attachment(self.product_a)
+ action = self.purchase_order.action_see_purchase_order_attachments()
+ attachments = self.env["ir.attachment"].search(action["domain"])
+ self.assertIn(attachment_a.id, attachments.ids)
+ self.assertIn(self.product_a.id, attachments.mapped("res_id"))
+ self.assertNotIn(self.product_b.id, attachments.mapped("res_id"))
+ attachment_b = self._create_attachment(self.product_b)
+ action = self.purchase_order.action_see_purchase_order_attachments()
+ attachments = self.env["ir.attachment"].search(action["domain"])
+ self.assertIn(attachment_b.id, attachments.ids)
+ self.assertIn(self.product_a.id, attachments.mapped("res_id"))
+ self.assertIn(self.product_b.id, attachments.mapped("res_id"))
diff --git a/purchase_order_product_attachment_mgmt/views/purchase_order_view.xml b/purchase_order_product_attachment_mgmt/views/purchase_order_view.xml
new file mode 100644
index 00000000000..b854939e450
--- /dev/null
+++ b/purchase_order_product_attachment_mgmt/views/purchase_order_view.xml
@@ -0,0 +1,29 @@
+
+
+
+ purchase.order.form
+ purchase.order
+
+
+
+
+
+
+
+
+ Attachments
+
+
+ code
+
+ if records:
+ action = records.action_see_purchase_order_attachments()
+
+
+
From 83e7e77e771bfa15bc7022920fb1f0d72caacafb Mon Sep 17 00:00:00 2001
From: Kevin Luna
Date: Thu, 9 Feb 2023 10:17:22 +0100
Subject: [PATCH 118/210] [14.0][FIX] purchase_order_product_attachment_mgmt:
xmlids
purchase_order_product_attachment_mgmt 14.0.1.0.1
[UPD] README.rst
---
.../README.rst | 15 ++++---
.../__manifest__.py | 2 +-
.../models/purchase_order.py | 2 +-
.../static/description/index.html | 40 ++++++++++---------
4 files changed, 32 insertions(+), 27 deletions(-)
diff --git a/purchase_order_product_attachment_mgmt/README.rst b/purchase_order_product_attachment_mgmt/README.rst
index bbf03a22312..b201a7a82e1 100644
--- a/purchase_order_product_attachment_mgmt/README.rst
+++ b/purchase_order_product_attachment_mgmt/README.rst
@@ -2,10 +2,13 @@
Purchase Order Product Attachment Mgmt
======================================
-.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+..
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ !! source digest: sha256:1016dace2e10de07a3d8b81c4648d250f31b3ff1dd9899a5b651051aba7c5fb8
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
@@ -19,11 +22,11 @@ Purchase Order Product Attachment Mgmt
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/purchase-workflow-14-0/purchase-workflow-14-0-purchase_order_product_attachment_mgmt
:alt: Translate me on Weblate
-.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/142/14.0
- :alt: Try me on Runbot
+.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=14.0
+ :alt: Try me on Runboat
-|badge1| |badge2| |badge3| |badge4| |badge5|
+|badge1| |badge2| |badge3| |badge4| |badge5|
This module allows to get all attachments from all products of a purchase on a view.
@@ -43,7 +46,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
-If you spotted it first, help us smashing it by providing a detailed and welcomed
+If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback `_.
Do not contact contributors directly about support or help with technical issues.
diff --git a/purchase_order_product_attachment_mgmt/__manifest__.py b/purchase_order_product_attachment_mgmt/__manifest__.py
index e0220b424a7..8eb9585be34 100644
--- a/purchase_order_product_attachment_mgmt/__manifest__.py
+++ b/purchase_order_product_attachment_mgmt/__manifest__.py
@@ -2,7 +2,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Purchase Order Product Attachment Mgmt",
- "version": "14.0.1.0.0",
+ "version": "14.0.1.0.1",
"category": "Purchases",
"website": "https://github.com/OCA/purchase-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
diff --git a/purchase_order_product_attachment_mgmt/models/purchase_order.py b/purchase_order_product_attachment_mgmt/models/purchase_order.py
index d2094f15f48..d60c5eb436f 100644
--- a/purchase_order_product_attachment_mgmt/models/purchase_order.py
+++ b/purchase_order_product_attachment_mgmt/models/purchase_order.py
@@ -16,7 +16,7 @@ def _action_see_purchase_order_attachments(self, products):
("res_model", "=", "product.template"),
("res_id", "in", products.mapped("product_tmpl_id").ids),
]
- res = self.env.ref("base.action_attachment").read()[0]
+ res = self.env["ir.actions.act_window"]._for_xml_id("base.action_attachment")
ctx = {"create": False, "edit": False}
res.update({"domain": domain, "context": ctx})
return res
diff --git a/purchase_order_product_attachment_mgmt/static/description/index.html b/purchase_order_product_attachment_mgmt/static/description/index.html
index 2fb118318c8..a95530bac4c 100644
--- a/purchase_order_product_attachment_mgmt/static/description/index.html
+++ b/purchase_order_product_attachment_mgmt/static/description/index.html
@@ -1,20 +1,20 @@
-
+
-
+
Purchase Order Product Attachment Mgmt
+
+
+
+
Purchase Order Qty change no recompute
+
+
+
+
This module prevents to recompute if only quantity has changed in purchase order line.
+
Table of contents
+
+
+
+
To use this module, you need to:
+
+Create a new purchase order.
+Add product line and set custom unit price.
+Save purchase order.
+Edit purchase order and change quantity (custom unit price not been reset).
+
+
+
+
+
Bugs are tracked on GitHub Issues .
+In case of trouble, please check there if your issue has already been reported.
+If you spotted it first, help us smashing it by providing a detailed and welcomed
+feedback .
+
Do not contact contributors directly about support or help with technical issues.
+
+
+
+
+
+
+
+Tecnativa :
+Víctor Martínez
+Pedro M. Baeza
+
+
+
+
+
+
+
This module is maintained by the OCA.
+
+
OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
+
Current maintainer :
+
+
This module is part of the OCA/purchase-workflow project on GitHub.
+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute .
+
+
+
+
+
diff --git a/purchase_order_qty_change_no_recompute/tests/__init__.py b/purchase_order_qty_change_no_recompute/tests/__init__.py
new file mode 100644
index 00000000000..4e42fb5b76b
--- /dev/null
+++ b/purchase_order_qty_change_no_recompute/tests/__init__.py
@@ -0,0 +1,2 @@
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+from . import test_purchase_order_qty_change
diff --git a/purchase_order_qty_change_no_recompute/tests/test_purchase_order_qty_change.py b/purchase_order_qty_change_no_recompute/tests/test_purchase_order_qty_change.py
new file mode 100644
index 00000000000..a0e8e5ad1eb
--- /dev/null
+++ b/purchase_order_qty_change_no_recompute/tests/test_purchase_order_qty_change.py
@@ -0,0 +1,49 @@
+# Copyright 2021 Tecnativa - Víctor Martínez
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+from odoo.tests.common import Form, SavepointCase
+
+
+class TestPurchaseOrderQtyChange(SavepointCase):
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+ cls.partner = cls.env["res.partner"].create({"name": "Test supplier"})
+ cls.product_1 = cls.env["product.product"].create(
+ {
+ "name": "Test Product 1",
+ "taxes_id": False,
+ "seller_ids": [
+ (0, False, {"name": cls.partner.id, "min_qty": 1, "price": 25.00}),
+ ],
+ }
+ )
+ cls.product_2 = cls.env["product.product"].create(
+ {
+ "name": "Test Product 2",
+ "taxes_id": False,
+ "seller_ids": [
+ (0, False, {"name": cls.partner.id, "min_qty": 1, "price": 30.00}),
+ ],
+ }
+ )
+ purchase_order_form = Form(
+ cls.env["purchase.order"].with_context(prevent_onchange_quantity=True)
+ )
+ purchase_order_form.partner_id = cls.partner
+ with purchase_order_form.order_line.new() as cls.line_form:
+ cls.line_form.product_id = cls.product_1
+ cls.line_form.product_qty = 1
+
+ def test_purchase_line_misc(self):
+ self.assertEqual(self.line_form.price_unit, 25)
+ self.assertEqual(self.line_form.price_subtotal, 25)
+ self.line_form.price_unit = 10
+ self.assertEqual(self.line_form.price_unit, 10)
+ self.assertEqual(self.line_form.price_subtotal, 10)
+ self.line_form.product_qty = 2
+ self.assertEqual(self.line_form.price_unit, 10)
+ self.assertEqual(self.line_form.price_subtotal, 20)
+ self.line_form.product_id = self.product_2
+ self.line_form.product_qty = 2
+ self.assertEqual(self.line_form.price_unit, 30)
+ self.assertEqual(self.line_form.price_subtotal, 60)
From a5011e239fa8838f3fc709410a99fb8bf9414f43 Mon Sep 17 00:00:00 2001
From: Cesar Andres Sanchez
Date: Wed, 6 Jul 2022 13:15:24 +0200
Subject: [PATCH 134/210] [MIG] purchase_order_qty_change_no_recompute:
Migration to 15.0
[UPD] Update purchase_order_qty_change_no_recompute.pot
[UPD] README.rst
---
purchase_order_qty_change_no_recompute/README.rst | 11 ++++++-----
.../__manifest__.py | 2 +-
.../i18n/purchase_order_qty_change_no_recompute.pot | 2 +-
.../readme/CONTRIBUTORS.rst | 1 +
.../static/description/index.html | 7 ++++---
5 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/purchase_order_qty_change_no_recompute/README.rst b/purchase_order_qty_change_no_recompute/README.rst
index f493d1bd28d..55bded23f5c 100644
--- a/purchase_order_qty_change_no_recompute/README.rst
+++ b/purchase_order_qty_change_no_recompute/README.rst
@@ -14,13 +14,13 @@ Purchase Order Qty change no recompute
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
- :target: https://github.com/OCA/purchase-workflow/tree/13.0/purchase_order_qty_change_no_recompute
+ :target: https://github.com/OCA/purchase-workflow/tree/15.0/purchase_order_qty_change_no_recompute
:alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/purchase-workflow-13-0/purchase-workflow-13-0-purchase_order_qty_change_no_recompute
+ :target: https://translation.odoo-community.org/projects/purchase-workflow-15-0/purchase-workflow-15-0-purchase_order_qty_change_no_recompute
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/142/13.0
+ :target: https://runbot.odoo-community.org/runbot/142/15.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -48,7 +48,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -67,6 +67,7 @@ Contributors
* Víctor Martínez
* Pedro M. Baeza
+ * César A. Sánchez
Maintainers
~~~~~~~~~~~
@@ -89,6 +90,6 @@ Current `maintainer `__:
|maintainer-victoralmau|
-This module is part of the `OCA/purchase-workflow `_ project on GitHub.
+This module is part of the `OCA/purchase-workflow `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/purchase_order_qty_change_no_recompute/__manifest__.py b/purchase_order_qty_change_no_recompute/__manifest__.py
index 3cd29f06a05..87ceff9d136 100644
--- a/purchase_order_qty_change_no_recompute/__manifest__.py
+++ b/purchase_order_qty_change_no_recompute/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Order Qty change no recompute",
"summary": "Prevent recompute if only quantity has changed in purchase order line",
- "version": "13.0.1.0.0",
+ "version": "15.0.1.0.0",
"category": "Purchases",
"website": "https://github.com/OCA/purchase-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
diff --git a/purchase_order_qty_change_no_recompute/i18n/purchase_order_qty_change_no_recompute.pot b/purchase_order_qty_change_no_recompute/i18n/purchase_order_qty_change_no_recompute.pot
index 8850de0236b..94a7798da0e 100644
--- a/purchase_order_qty_change_no_recompute/i18n/purchase_order_qty_change_no_recompute.pot
+++ b/purchase_order_qty_change_no_recompute/i18n/purchase_order_qty_change_no_recompute.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 13.0\n"
+"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
diff --git a/purchase_order_qty_change_no_recompute/readme/CONTRIBUTORS.rst b/purchase_order_qty_change_no_recompute/readme/CONTRIBUTORS.rst
index 5fb71305308..b0a21ac79f4 100644
--- a/purchase_order_qty_change_no_recompute/readme/CONTRIBUTORS.rst
+++ b/purchase_order_qty_change_no_recompute/readme/CONTRIBUTORS.rst
@@ -2,3 +2,4 @@
* Víctor Martínez
* Pedro M. Baeza
+ * César A. Sánchez
diff --git a/purchase_order_qty_change_no_recompute/static/description/index.html b/purchase_order_qty_change_no_recompute/static/description/index.html
index accb30bb2ec..4faec234215 100644
--- a/purchase_order_qty_change_no_recompute/static/description/index.html
+++ b/purchase_order_qty_change_no_recompute/static/description/index.html
@@ -367,7 +367,7 @@ Purchase Order Qty change no recompute
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
This module prevents to recompute if only quantity has changed in purchase order line.
Table of contents
@@ -397,7 +397,7 @@
Bugs are tracked on GitHub Issues .
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-feedback .
+
feedback .
Do not contact contributors directly about support or help with technical issues.
From 9ef06ac972e9bf8db5a0a7d3f06a2bc3a74f6d5f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?=
Date: Wed, 26 Oct 2022 08:46:41 +0200
Subject: [PATCH 135/210] [FIX] Change SavepointCase to TransactionCase
purchase_order_qty_change_no_recompute 15.0.1.0.1
---
purchase_order_qty_change_no_recompute/__manifest__.py | 2 +-
.../tests/test_purchase_order_qty_change.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/purchase_order_qty_change_no_recompute/__manifest__.py b/purchase_order_qty_change_no_recompute/__manifest__.py
index 87ceff9d136..bff8eb40abb 100644
--- a/purchase_order_qty_change_no_recompute/__manifest__.py
+++ b/purchase_order_qty_change_no_recompute/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Purchase Order Qty change no recompute",
"summary": "Prevent recompute if only quantity has changed in purchase order line",
- "version": "15.0.1.0.0",
+ "version": "15.0.1.0.1",
"category": "Purchases",
"website": "https://github.com/OCA/purchase-workflow",
"author": "Tecnativa, Odoo Community Association (OCA)",
diff --git a/purchase_order_qty_change_no_recompute/tests/test_purchase_order_qty_change.py b/purchase_order_qty_change_no_recompute/tests/test_purchase_order_qty_change.py
index a0e8e5ad1eb..d61773a7d08 100644
--- a/purchase_order_qty_change_no_recompute/tests/test_purchase_order_qty_change.py
+++ b/purchase_order_qty_change_no_recompute/tests/test_purchase_order_qty_change.py
@@ -1,9 +1,9 @@
# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-from odoo.tests.common import Form, SavepointCase
+from odoo.tests.common import Form, TransactionCase
-class TestPurchaseOrderQtyChange(SavepointCase):
+class TestPurchaseOrderQtyChange(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
From 99ac7b82124bffe4d52f22d6cd0ee78e0f3b7dbd Mon Sep 17 00:00:00 2001
From: Ivorra78
Date: Thu, 13 Jul 2023 07:58:23 +0000
Subject: [PATCH 136/210] Added translation using Weblate (Spanish)
Translated using Weblate (Spanish)
Currently translated at 100.0% (1 of 1 strings)
Translation: purchase-workflow-15.0/purchase-workflow-15.0-purchase_order_qty_change_no_recompute
Translate-URL: https://translation.odoo-community.org/projects/purchase-workflow-15-0/purchase-workflow-15-0-purchase_order_qty_change_no_recompute/es/
[UPD] README.rst
---
.../README.rst | 15 ++++---
.../i18n/es.po | 22 ++++++++++
.../static/description/index.html | 40 ++++++++++---------
3 files changed, 52 insertions(+), 25 deletions(-)
create mode 100644 purchase_order_qty_change_no_recompute/i18n/es.po
diff --git a/purchase_order_qty_change_no_recompute/README.rst b/purchase_order_qty_change_no_recompute/README.rst
index 55bded23f5c..af69ba02a4e 100644
--- a/purchase_order_qty_change_no_recompute/README.rst
+++ b/purchase_order_qty_change_no_recompute/README.rst
@@ -2,10 +2,13 @@
Purchase Order Qty change no recompute
======================================
-.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+..
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ !! source digest: sha256:8da639b20ed31ded8069c09c61e84128d5c62834ea8d58879a3e5c3bd7ff5183
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
@@ -19,11 +22,11 @@ Purchase Order Qty change no recompute
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/purchase-workflow-15-0/purchase-workflow-15-0-purchase_order_qty_change_no_recompute
:alt: Translate me on Weblate
-.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/142/15.0
- :alt: Try me on Runbot
+.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=15.0
+ :alt: Try me on Runboat
-|badge1| |badge2| |badge3| |badge4| |badge5|
+|badge1| |badge2| |badge3| |badge4| |badge5|
This module prevents to recompute if only quantity has changed in purchase order line.
@@ -47,7 +50,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
-If you spotted it first, help us smashing it by providing a detailed and welcomed
+If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback `_.
Do not contact contributors directly about support or help with technical issues.
diff --git a/purchase_order_qty_change_no_recompute/i18n/es.po b/purchase_order_qty_change_no_recompute/i18n/es.po
new file mode 100644
index 00000000000..5f11af72699
--- /dev/null
+++ b/purchase_order_qty_change_no_recompute/i18n/es.po
@@ -0,0 +1,22 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * purchase_order_qty_change_no_recompute
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 15.0\n"
+"Report-Msgid-Bugs-To: \n"
+"PO-Revision-Date: 2023-07-13 10:09+0000\n"
+"Last-Translator: Ivorra78 \n"
+"Language-Team: none\n"
+"Language: es\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Generator: Weblate 4.17\n"
+
+#. module: purchase_order_qty_change_no_recompute
+#: model:ir.model,name:purchase_order_qty_change_no_recompute.model_purchase_order_line
+msgid "Purchase Order Line"
+msgstr "Línea de pedido de compra"
diff --git a/purchase_order_qty_change_no_recompute/static/description/index.html b/purchase_order_qty_change_no_recompute/static/description/index.html
index 4faec234215..da89d161324 100644
--- a/purchase_order_qty_change_no_recompute/static/description/index.html
+++ b/purchase_order_qty_change_no_recompute/static/description/index.html
@@ -1,20 +1,20 @@
-
+
-
+
Purchase Order Qty change no recompute
+
+
+
+
Procurement Purchase No Grouping
+
+
+
+
This module allows to not group generated purchase orders from procurements.
+The grouping behaviour can be configurable at product category level.
+
Table of contents
+
+
+
+
Go to each product category, and select one of these values in the field
+“Procured purchase grouping”:
+
+Standard grouping (default) : With this option, procurements will generate
+purchase orders as always, grouping lines and orders when possible.
+No line grouping : With this value, if there are any open purchase order
+for the same supplier, it will be reused, but lines won’t be merged.
+No order grouping : This option will prevent any kind of grouping.
+
+
+
+
+
Bugs are tracked on GitHub Issues .
+In case of trouble, please check there if your issue has already been reported.
+If you spotted it first, help us smashing it by providing a detailed and welcomed
+feedback .
+
Do not contact contributors directly about support or help with technical issues.
+
+
+
+
+
+
+
+
This module is maintained by the OCA.
+
+
OCA, or the Odoo Community Association, is a nonprofit organization whose
+mission is to support the collaborative development of Odoo features and
+promote its widespread use.
+
This module is part of the OCA/purchase-workflow project on GitHub.
+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute .
+
+
+
+
+
diff --git a/procurement_purchase_no_grouping/tests/test_procurement_purchase_no_grouping.py b/procurement_purchase_no_grouping/tests/test_procurement_purchase_no_grouping.py
index bf32a31272e..82d30af1eb5 100644
--- a/procurement_purchase_no_grouping/tests/test_procurement_purchase_no_grouping.py
+++ b/procurement_purchase_no_grouping/tests/test_procurement_purchase_no_grouping.py
@@ -1,6 +1,7 @@
# Copyright 2015-2017 - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
+from odoo import fields
from odoo.tests import common
@@ -24,69 +25,66 @@ def setUpClass(cls):
}),
]}
)
- cls.procurement = cls.env['procurement.order'].create({
- 'name': 'Procurement test',
- 'product_id': cls.product.id,
- 'product_uom': cls.product.uom_id.id,
- 'warehouse_id': cls.env.ref('stock.warehouse0').id,
- 'location_id': cls.env.ref('stock.stock_location_stock').id,
- 'route_ids': [
- (6, 0, [cls.env.ref('purchase.route_warehouse0_buy').id]),
- ],
- 'product_qty': 1.0,
+ # FIXME: Core doesn't find correctly supplier if this is not set
+ cls.product.seller_ids.product_id = cls.product.id
+ cls.location = cls.env.ref('stock.stock_location_stock')
+ cls.picking_type = cls.env.ref('stock.picking_type_in')
+ cls.origin = 'Test procurement_purchase_no_grouping'
+ cls.stock_location_route = cls.env.ref('purchase.route_warehouse0_buy')
+ cls.procurement_rule = cls.stock_location_route.pull_ids[0]
+ cls.values = {
+ # FIXME: Core doesn't find correctly supplier if not recordset
+ 'company_id': cls.env.user.company_id,
+ 'date_planned': fields.Datetime.now(),
}
+
+ def _run_procurement(self):
+ self.procurement_rule._run_buy(
+ self.product, 1, self.product.uom_id, self.location, False,
+ self.origin, self.values,
)
def test_procurement_grouped_purchase(self):
self.category.procured_purchase_grouping = 'standard'
- procurement_1 = self.procurement.copy()
- procurement_2 = self.procurement.copy()
- procurement_1.run()
- procurement_2.run()
- self.assertTrue(procurement_1.purchase_id)
- self.assertTrue(procurement_2.purchase_id)
+ self._run_procurement()
+ self._run_procurement()
+ orders = self.env['purchase.order'].search([
+ ('origin', '=', self.origin),
+ ])
self.assertEqual(
- procurement_1.purchase_id, procurement_2.purchase_id,
- 'Procured purchase orders are not the same',
+ len(orders), 1, 'Procured purchase orders are not the same',
)
self.assertEqual(
- procurement_1.purchase_line_id, procurement_2.purchase_line_id,
+ len(orders.order_line), 1,
'Procured purchase orders lines are not the same',
)
- return True
def test_procurement_no_grouping_line_purchase(self):
self.category.procured_purchase_grouping = 'line'
- procurement_1 = self.procurement.copy()
- procurement_2 = self.procurement.copy()
- procurement_1.run()
- procurement_2.run()
- self.assertTrue(procurement_1.purchase_id)
- self.assertTrue(procurement_2.purchase_id)
+ self._run_procurement()
+ self._run_procurement()
+ orders = self.env['purchase.order'].search([
+ ('origin', '=', self.origin),
+ ])
self.assertEqual(
- procurement_1.purchase_id, procurement_2.purchase_id,
- 'Procured purchase orders are not the same',
+ len(orders), 1, 'Procured purchase orders are not the same',
)
- self.assertNotEqual(
- procurement_1.purchase_line_id, procurement_2.purchase_line_id,
+ self.assertEqual(
+ len(orders.order_line), 2,
'Procured purchase orders lines are the same',
)
- return True
def test_procurement_no_grouping_order_purchase(self):
self.category.procured_purchase_grouping = 'order'
- procurement_1 = self.procurement.copy()
- procurement_2 = self.procurement.copy()
- procurement_1.run()
- procurement_2.run()
- self.assertTrue(procurement_1.purchase_id)
- self.assertTrue(procurement_2.purchase_id)
- self.assertNotEqual(
- procurement_1.purchase_id, procurement_2.purchase_id,
- 'Procured purchase orders are the same',
+ self._run_procurement()
+ self._run_procurement()
+ orders = self.env['purchase.order'].search([
+ ('origin', '=', self.origin),
+ ])
+ self.assertEqual(
+ len(orders), 2, 'Procured purchase orders are the same',
)
- self.assertNotEqual(
- procurement_1.purchase_line_id, procurement_2.purchase_line_id,
+ self.assertEqual(
+ len(orders.mapped('order_line')), 2,
'Procured purchase orders lines are the same',
)
- return True
From 10c0ff9efa0c12c19a54ae12f4a77e377d60770a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexandre=20D=C3=ADaz?=
Date: Mon, 17 Jun 2019 19:46:00 +0200
Subject: [PATCH 156/210] [MIG] procurement_purchase_no_grouping: Migration to
12.0
---
procurement_purchase_no_grouping/README.rst | 11 ++---
procurement_purchase_no_grouping/__init__.py | 2 -
.../__manifest__.py | 4 +-
procurement_purchase_no_grouping/i18n/de.po | 14 +++----
procurement_purchase_no_grouping/i18n/es.po | 14 +++----
.../i18n/es_ES.po | 14 +++----
.../i18n/es_MX.po | 14 +++----
.../i18n/es_PE.po | 19 +++++----
procurement_purchase_no_grouping/i18n/fi.po | 14 +++----
procurement_purchase_no_grouping/i18n/fr.po | 14 +++----
.../i18n/fr_BE.po | 14 +++----
.../i18n/fr_FR.po | 14 +++----
procurement_purchase_no_grouping/i18n/gl.po | 14 +++----
procurement_purchase_no_grouping/i18n/hr.po | 19 +++++----
procurement_purchase_no_grouping/i18n/it.po | 14 +++----
procurement_purchase_no_grouping/i18n/nl.po | 14 +++----
.../i18n/nl_NL.po | 14 +++----
.../i18n/procurement_purchase_no_grouping.pot | 16 ++++----
.../i18n/pt_BR.po | 14 +++----
.../i18n/pt_PT.po | 14 +++----
procurement_purchase_no_grouping/i18n/ro.po | 14 +++----
procurement_purchase_no_grouping/i18n/sl.po | 14 +++----
.../i18n/tr_TR.po | 19 +++++----
.../i18n/vi_VN.po | 14 +++----
.../i18n/zh_CN.po | 40 +++++++++++--------
.../models/__init__.py | 4 +-
.../{procurement_rule.py => stock_rule.py} | 6 +--
.../readme/CONTRIBUTORS.rst | 1 +
.../static/description/index.html | 9 +++--
.../tests/__init__.py | 2 -
.../test_procurement_purchase_no_grouping.py | 7 ++--
31 files changed, 206 insertions(+), 191 deletions(-)
rename procurement_purchase_no_grouping/models/{procurement_rule.py => stock_rule.py} (86%)
diff --git a/procurement_purchase_no_grouping/README.rst b/procurement_purchase_no_grouping/README.rst
index 1826fe9877d..9c4ca05122e 100644
--- a/procurement_purchase_no_grouping/README.rst
+++ b/procurement_purchase_no_grouping/README.rst
@@ -14,13 +14,13 @@ Procurement Purchase No Grouping
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
- :target: https://github.com/OCA/purchase-workflow/tree/11.0/procurement_purchase_no_grouping
+ :target: https://github.com/OCA/purchase-workflow/tree/12.0/procurement_purchase_no_grouping
:alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/purchase-workflow-11-0/purchase-workflow-11-0-procurement_purchase_no_grouping
+ :target: https://translation.odoo-community.org/projects/purchase-workflow-12-0/purchase-workflow-12-0-procurement_purchase_no_grouping
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
- :target: https://runbot.odoo-community.org/runbot/142/11.0
+ :target: https://runbot.odoo-community.org/runbot/142/12.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -51,7 +51,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues `_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -72,6 +72,7 @@ Contributors
* Pedro M. Baeza
* Sergio Teruel
* Carlos Dauden
+ * Alexandre Díaz
* Ana Juaristi
* Alfredo de la Fuente
@@ -89,6 +90,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
-This module is part of the `OCA/purchase-workflow `_ project on GitHub.
+This module is part of the `OCA/purchase-workflow `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/procurement_purchase_no_grouping/__init__.py b/procurement_purchase_no_grouping/__init__.py
index 21101d3490d..0650744f6bc 100644
--- a/procurement_purchase_no_grouping/__init__.py
+++ b/procurement_purchase_no_grouping/__init__.py
@@ -1,3 +1 @@
-# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
-
from . import models
diff --git a/procurement_purchase_no_grouping/__manifest__.py b/procurement_purchase_no_grouping/__manifest__.py
index e677f7cf323..e3025a71406 100644
--- a/procurement_purchase_no_grouping/__manifest__.py
+++ b/procurement_purchase_no_grouping/__manifest__.py
@@ -5,14 +5,14 @@
{
'name': 'Procurement Purchase No Grouping',
- 'version': '11.0.1.0.0',
+ 'version': '12.0.1.0.0',
'author': 'AvanzOSC,'
'Tecnativa,'
'Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/purchase-workflow',
'category': 'Procurements',
'depends': [
- 'purchase',
+ 'purchase_stock',
],
'data': [
'views/product_category_view.xml',
diff --git a/procurement_purchase_no_grouping/i18n/de.po b/procurement_purchase_no_grouping/i18n/de.po
index 25e0c32d9d5..1b37bbe8ece 100644
--- a/procurement_purchase_no_grouping/i18n/de.po
+++ b/procurement_purchase_no_grouping/i18n/de.po
@@ -29,15 +29,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -49,7 +44,7 @@ msgid "Purchase Order Line"
msgstr "Bestellposition"
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -65,5 +60,10 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
#~ msgid "Purchase Order"
#~ msgstr "Bestellauftrag"
diff --git a/procurement_purchase_no_grouping/i18n/es.po b/procurement_purchase_no_grouping/i18n/es.po
index 12259577220..b80add71789 100644
--- a/procurement_purchase_no_grouping/i18n/es.po
+++ b/procurement_purchase_no_grouping/i18n/es.po
@@ -29,15 +29,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -49,7 +44,7 @@ msgid "Purchase Order Line"
msgstr "Línea orden de compra"
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -65,5 +60,10 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
#~ msgid "Purchase Order"
#~ msgstr "Orden de Compra"
diff --git a/procurement_purchase_no_grouping/i18n/es_ES.po b/procurement_purchase_no_grouping/i18n/es_ES.po
index 76a0607c1ad..ffcf1d2881c 100644
--- a/procurement_purchase_no_grouping/i18n/es_ES.po
+++ b/procurement_purchase_no_grouping/i18n/es_ES.po
@@ -30,15 +30,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -50,7 +45,7 @@ msgid "Purchase Order Line"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -65,3 +60,8 @@ msgstr ""
#: selection:product.category,procured_purchase_grouping:0
msgid "Standard grouping"
msgstr ""
+
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
diff --git a/procurement_purchase_no_grouping/i18n/es_MX.po b/procurement_purchase_no_grouping/i18n/es_MX.po
index d05a62fb3d7..29fd3dbc26b 100644
--- a/procurement_purchase_no_grouping/i18n/es_MX.po
+++ b/procurement_purchase_no_grouping/i18n/es_MX.po
@@ -30,15 +30,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -50,7 +45,7 @@ msgid "Purchase Order Line"
msgstr "Línea de orden de compra"
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -65,3 +60,8 @@ msgstr ""
#: selection:product.category,procured_purchase_grouping:0
msgid "Standard grouping"
msgstr ""
+
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
diff --git a/procurement_purchase_no_grouping/i18n/es_PE.po b/procurement_purchase_no_grouping/i18n/es_PE.po
index 4a09590cbb6..4ba9775096a 100644
--- a/procurement_purchase_no_grouping/i18n/es_PE.po
+++ b/procurement_purchase_no_grouping/i18n/es_PE.po
@@ -30,16 +30,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-#, fuzzy
-msgid "Procurement Rule"
-msgstr "Aquisiciones"
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -51,7 +45,7 @@ msgid "Purchase Order Line"
msgstr "Linea de orden de compra"
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -67,5 +61,14 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
+#, fuzzy
+#~ msgid "Procurement Rule"
+#~ msgstr "Aquisiciones"
+
#~ msgid "Purchase Order"
#~ msgstr "Orden de compra"
diff --git a/procurement_purchase_no_grouping/i18n/fi.po b/procurement_purchase_no_grouping/i18n/fi.po
index 3bac304ae5d..eeea3b688af 100644
--- a/procurement_purchase_no_grouping/i18n/fi.po
+++ b/procurement_purchase_no_grouping/i18n/fi.po
@@ -29,15 +29,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -49,7 +44,7 @@ msgid "Purchase Order Line"
msgstr "Ostotilausrivi"
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -64,3 +59,8 @@ msgstr ""
#: selection:product.category,procured_purchase_grouping:0
msgid "Standard grouping"
msgstr ""
+
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
diff --git a/procurement_purchase_no_grouping/i18n/fr.po b/procurement_purchase_no_grouping/i18n/fr.po
index 0947162c7dd..c1005a6a80d 100644
--- a/procurement_purchase_no_grouping/i18n/fr.po
+++ b/procurement_purchase_no_grouping/i18n/fr.po
@@ -29,15 +29,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -49,7 +44,7 @@ msgid "Purchase Order Line"
msgstr "Ligne de commande d'achat"
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -65,5 +60,10 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
#~ msgid "Purchase Order"
#~ msgstr "Bon de commande"
diff --git a/procurement_purchase_no_grouping/i18n/fr_BE.po b/procurement_purchase_no_grouping/i18n/fr_BE.po
index 3b8ec5f783d..d95a9a209c2 100644
--- a/procurement_purchase_no_grouping/i18n/fr_BE.po
+++ b/procurement_purchase_no_grouping/i18n/fr_BE.po
@@ -30,15 +30,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -50,7 +45,7 @@ msgid "Purchase Order Line"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -66,5 +61,10 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
#~ msgid "Purchase Order"
#~ msgstr "Commande fournisseur"
diff --git a/procurement_purchase_no_grouping/i18n/fr_FR.po b/procurement_purchase_no_grouping/i18n/fr_FR.po
index 3b064d3c075..6a7ea27d116 100644
--- a/procurement_purchase_no_grouping/i18n/fr_FR.po
+++ b/procurement_purchase_no_grouping/i18n/fr_FR.po
@@ -30,15 +30,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -50,7 +45,7 @@ msgid "Purchase Order Line"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -66,5 +61,10 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
#~ msgid "Purchase Order"
#~ msgstr "Bon de commande"
diff --git a/procurement_purchase_no_grouping/i18n/gl.po b/procurement_purchase_no_grouping/i18n/gl.po
index cbceed5c56d..dc4e94717d5 100644
--- a/procurement_purchase_no_grouping/i18n/gl.po
+++ b/procurement_purchase_no_grouping/i18n/gl.po
@@ -29,15 +29,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -49,7 +44,7 @@ msgid "Purchase Order Line"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -65,5 +60,10 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
#~ msgid "Purchase Order"
#~ msgstr "Orde de compra"
diff --git a/procurement_purchase_no_grouping/i18n/hr.po b/procurement_purchase_no_grouping/i18n/hr.po
index 260784c82c6..86e9c72b0d6 100644
--- a/procurement_purchase_no_grouping/i18n/hr.po
+++ b/procurement_purchase_no_grouping/i18n/hr.po
@@ -30,16 +30,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-#, fuzzy
-msgid "Procurement Rule"
-msgstr "Nabava"
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -51,7 +45,7 @@ msgid "Purchase Order Line"
msgstr "Stavka naloga za nabavu"
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -67,5 +61,14 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
+#, fuzzy
+#~ msgid "Procurement Rule"
+#~ msgstr "Nabava"
+
#~ msgid "Purchase Order"
#~ msgstr "Nabavni nalog"
diff --git a/procurement_purchase_no_grouping/i18n/it.po b/procurement_purchase_no_grouping/i18n/it.po
index 499d7f2f51d..17362b3b9d3 100644
--- a/procurement_purchase_no_grouping/i18n/it.po
+++ b/procurement_purchase_no_grouping/i18n/it.po
@@ -29,15 +29,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -49,7 +44,7 @@ msgid "Purchase Order Line"
msgstr "Riga Ordine d'Acquisto"
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -65,5 +60,10 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
#~ msgid "Purchase Order"
#~ msgstr "Ordine Acquisto"
diff --git a/procurement_purchase_no_grouping/i18n/nl.po b/procurement_purchase_no_grouping/i18n/nl.po
index 3df282116ad..454fa3aa30d 100644
--- a/procurement_purchase_no_grouping/i18n/nl.po
+++ b/procurement_purchase_no_grouping/i18n/nl.po
@@ -29,15 +29,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -49,7 +44,7 @@ msgid "Purchase Order Line"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -65,5 +60,10 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
#~ msgid "Purchase Order"
#~ msgstr "Inkooporder"
diff --git a/procurement_purchase_no_grouping/i18n/nl_NL.po b/procurement_purchase_no_grouping/i18n/nl_NL.po
index 459e901bb30..5a3c16e8179 100644
--- a/procurement_purchase_no_grouping/i18n/nl_NL.po
+++ b/procurement_purchase_no_grouping/i18n/nl_NL.po
@@ -30,15 +30,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -50,7 +45,7 @@ msgid "Purchase Order Line"
msgstr "Inkooporderregel"
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -66,5 +61,10 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
#~ msgid "Purchase Order"
#~ msgstr "Inkooporder"
diff --git a/procurement_purchase_no_grouping/i18n/procurement_purchase_no_grouping.pot b/procurement_purchase_no_grouping/i18n/procurement_purchase_no_grouping.pot
index e187f22c4de..506b5a6ff3f 100644
--- a/procurement_purchase_no_grouping/i18n/procurement_purchase_no_grouping.pot
+++ b/procurement_purchase_no_grouping/i18n/procurement_purchase_no_grouping.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 11.0\n"
+"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
@@ -24,15 +24,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -44,7 +39,7 @@ msgid "Purchase Order Line"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Select the behaviour for grouping procured purchases for the the products of this category:\n"
"* Standard grouping (default): Procurements will generate purchase orders as always, grouping lines and orders when possible.\n"
"* No line grouping: If there are any open purchase order for the same supplier, it will be reused, but lines won't be merged.\n"
@@ -56,3 +51,8 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
diff --git a/procurement_purchase_no_grouping/i18n/pt_BR.po b/procurement_purchase_no_grouping/i18n/pt_BR.po
index b5f3cbaa6ad..86ecf0b12f1 100644
--- a/procurement_purchase_no_grouping/i18n/pt_BR.po
+++ b/procurement_purchase_no_grouping/i18n/pt_BR.po
@@ -30,15 +30,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -50,7 +45,7 @@ msgid "Purchase Order Line"
msgstr "Linha da Ordem de Compra"
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -66,5 +61,10 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
#~ msgid "Purchase Order"
#~ msgstr "Ordem de Compra"
diff --git a/procurement_purchase_no_grouping/i18n/pt_PT.po b/procurement_purchase_no_grouping/i18n/pt_PT.po
index 56bf561b4a0..f3a135023da 100644
--- a/procurement_purchase_no_grouping/i18n/pt_PT.po
+++ b/procurement_purchase_no_grouping/i18n/pt_PT.po
@@ -30,15 +30,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -50,7 +45,7 @@ msgid "Purchase Order Line"
msgstr "Linha de Encomenda de Compra"
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -65,3 +60,8 @@ msgstr ""
#: selection:product.category,procured_purchase_grouping:0
msgid "Standard grouping"
msgstr ""
+
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
diff --git a/procurement_purchase_no_grouping/i18n/ro.po b/procurement_purchase_no_grouping/i18n/ro.po
index a60470edeb6..5d1a85f9588 100644
--- a/procurement_purchase_no_grouping/i18n/ro.po
+++ b/procurement_purchase_no_grouping/i18n/ro.po
@@ -30,15 +30,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -50,7 +45,7 @@ msgid "Purchase Order Line"
msgstr "Linie comandă achiziție"
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -66,5 +61,10 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
#~ msgid "Purchase Order"
#~ msgstr "Comandă achiziție"
diff --git a/procurement_purchase_no_grouping/i18n/sl.po b/procurement_purchase_no_grouping/i18n/sl.po
index e3ef882cbec..429402fb489 100644
--- a/procurement_purchase_no_grouping/i18n/sl.po
+++ b/procurement_purchase_no_grouping/i18n/sl.po
@@ -30,15 +30,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -50,7 +45,7 @@ msgid "Purchase Order Line"
msgstr "Postavka nabavnega naloga"
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -66,5 +61,10 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
#~ msgid "Purchase Order"
#~ msgstr "Nabavni nalog"
diff --git a/procurement_purchase_no_grouping/i18n/tr_TR.po b/procurement_purchase_no_grouping/i18n/tr_TR.po
index f079a3de1b2..9c76f6828c2 100644
--- a/procurement_purchase_no_grouping/i18n/tr_TR.po
+++ b/procurement_purchase_no_grouping/i18n/tr_TR.po
@@ -30,16 +30,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-#, fuzzy
-msgid "Procurement Rule"
-msgstr "Satın alma"
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -51,7 +45,7 @@ msgid "Purchase Order Line"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -66,3 +60,12 @@ msgstr ""
#: selection:product.category,procured_purchase_grouping:0
msgid "Standard grouping"
msgstr ""
+
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
+#, fuzzy
+#~ msgid "Procurement Rule"
+#~ msgstr "Satın alma"
diff --git a/procurement_purchase_no_grouping/i18n/vi_VN.po b/procurement_purchase_no_grouping/i18n/vi_VN.po
index 2661844a6cf..69d0d2c5092 100644
--- a/procurement_purchase_no_grouping/i18n/vi_VN.po
+++ b/procurement_purchase_no_grouping/i18n/vi_VN.po
@@ -30,15 +30,10 @@ msgid "No order grouping"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
msgstr ""
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-msgid "Procurement Rule"
-msgstr ""
-
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
@@ -50,7 +45,7 @@ msgid "Purchase Order Line"
msgstr ""
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -66,5 +61,10 @@ msgstr ""
msgid "Standard grouping"
msgstr ""
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr ""
+
#~ msgid "Purchase Order"
#~ msgstr "Đơn hàng Mua"
diff --git a/procurement_purchase_no_grouping/i18n/zh_CN.po b/procurement_purchase_no_grouping/i18n/zh_CN.po
index 5b33a129344..6fa6cc66af6 100644
--- a/procurement_purchase_no_grouping/i18n/zh_CN.po
+++ b/procurement_purchase_no_grouping/i18n/zh_CN.po
@@ -9,8 +9,8 @@ msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-16 02:54+0000\n"
-"PO-Revision-Date: 2017-07-16 02:54+0000\n"
-"Last-Translator: OCA Transbot , 2017\n"
+"PO-Revision-Date: 2019-09-01 16:00+0000\n"
+"Last-Translator: 黎伟杰 <674416404@qq.com>\n"
"Language-Team: Chinese (China) (https://www.transifex.com/oca/teams/23907/"
"zh_CN/)\n"
"Language: zh_CN\n"
@@ -18,40 +18,35 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=1; plural=0;\n"
+"X-Generator: Weblate 3.8\n"
#. module: procurement_purchase_no_grouping
#: selection:product.category,procured_purchase_grouping:0
msgid "No line grouping"
-msgstr ""
+msgstr "没有行分组"
#. module: procurement_purchase_no_grouping
#: selection:product.category,procured_purchase_grouping:0
msgid "No order grouping"
-msgstr ""
+msgstr "没有行分组"
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,field_description:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid "Procured purchase grouping"
-msgstr ""
-
-#. module: procurement_purchase_no_grouping
-#: model:ir.model,name:procurement_purchase_no_grouping.model_procurement_rule
-#, fuzzy
-msgid "Procurement Rule"
-msgstr "补货"
+msgstr "采购分组"
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_product_category
msgid "Product Category"
-msgstr ""
+msgstr "产品分类"
#. module: procurement_purchase_no_grouping
#: model:ir.model,name:procurement_purchase_no_grouping.model_purchase_order_line
msgid "Purchase Order Line"
-msgstr ""
+msgstr "采购订单行"
#. module: procurement_purchase_no_grouping
-#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category_procured_purchase_grouping
+#: model:ir.model.fields,help:procurement_purchase_no_grouping.field_product_category__procured_purchase_grouping
msgid ""
"Select the behaviour for grouping procured purchases for the the products of "
"this category:\n"
@@ -61,8 +56,21 @@ msgid ""
"supplier, it will be reused, but lines won't be merged.\n"
"* No order grouping: This option will prevent any kind of grouping."
msgstr ""
+"选择为此类别的产品分组采购购买的行为:\n"
+"* 标准分组(默认):采购将一如既往地生成采购订单,尽可能对生产线和订单进行分组。\n"
+"* 无行分组:如果同一供应商有任何未结采购订单,则会重复使用,但不会合并行。\n"
+"* 没有订单分组:此选项将阻止任何类型的分组。"
#. module: procurement_purchase_no_grouping
#: selection:product.category,procured_purchase_grouping:0
msgid "Standard grouping"
-msgstr ""
+msgstr "标准分组"
+
+#. module: procurement_purchase_no_grouping
+#: model:ir.model,name:procurement_purchase_no_grouping.model_stock_rule
+msgid "Stock Rule"
+msgstr "库存规则"
+
+#, fuzzy
+#~ msgid "Procurement Rule"
+#~ msgstr "补货"
diff --git a/procurement_purchase_no_grouping/models/__init__.py b/procurement_purchase_no_grouping/models/__init__.py
index a5867794c18..cabf9323890 100644
--- a/procurement_purchase_no_grouping/models/__init__.py
+++ b/procurement_purchase_no_grouping/models/__init__.py
@@ -1,5 +1,3 @@
-# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
-
from . import product_category
-from . import procurement_rule
+from . import stock_rule
from . import purchase_order
diff --git a/procurement_purchase_no_grouping/models/procurement_rule.py b/procurement_purchase_no_grouping/models/stock_rule.py
similarity index 86%
rename from procurement_purchase_no_grouping/models/procurement_rule.py
rename to procurement_purchase_no_grouping/models/stock_rule.py
index 49a8371aebe..9c48ef34ced 100644
--- a/procurement_purchase_no_grouping/models/procurement_rule.py
+++ b/procurement_purchase_no_grouping/models/stock_rule.py
@@ -6,15 +6,15 @@
from odoo import api, models
-class ProcurementRule(models.Model):
- _inherit = 'procurement.rule'
+class StockRule(models.Model):
+ _inherit = 'stock.rule'
@api.multi
def _run_buy(self, product_id, product_qty, product_uom, location_id,
name, origin, values):
grouping = product_id.categ_id.procured_purchase_grouping
self_wc = self.with_context(grouping=grouping)
- return super(ProcurementRule, self_wc)._run_buy(
+ return super(StockRule, self_wc)._run_buy(
product_id, product_qty, product_uom, location_id, name,
origin, values)
diff --git a/procurement_purchase_no_grouping/readme/CONTRIBUTORS.rst b/procurement_purchase_no_grouping/readme/CONTRIBUTORS.rst
index 170913ca481..d3575bf047f 100644
--- a/procurement_purchase_no_grouping/readme/CONTRIBUTORS.rst
+++ b/procurement_purchase_no_grouping/readme/CONTRIBUTORS.rst
@@ -3,6 +3,7 @@
* Pedro M. Baeza
* Sergio Teruel
* Carlos Dauden
+ * Alexandre Díaz
* Ana Juaristi
* Alfredo de la Fuente
diff --git a/procurement_purchase_no_grouping/static/description/index.html b/procurement_purchase_no_grouping/static/description/index.html
index 3f3005935bd..492ed085517 100644
--- a/procurement_purchase_no_grouping/static/description/index.html
+++ b/procurement_purchase_no_grouping/static/description/index.html
@@ -3,7 +3,7 @@
-
+
Procurement Purchase No Grouping