diff --git a/.gitmodules b/.gitmodules index fa929277..e3c0dec6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -26,3 +26,6 @@ [submodule "external/hibou-oca/bank-payment"] path = external/hibou-oca/bank-payment url = https://github.com/hibou-io/oca-bank-payment.git +[submodule "external/hibou-shipbox"] + path = external/hibou-shipbox + url = https://github.com/hibou-io/shipbox.git diff --git a/account_payment_disperse/README.rst b/account_payment_disperse/README.rst index 70b46e87..c25ff27a 100644 --- a/account_payment_disperse/README.rst +++ b/account_payment_disperse/README.rst @@ -27,11 +27,6 @@ Main Features :width: 988 :align: left -============= -Known Issues -============= - -* It is technically possible, but *not* recommended, to change which invoices are in the wizard. You've been warned. ======= License diff --git a/account_payment_disperse/wizard/register_payment_wizard_views.xml b/account_payment_disperse/wizard/register_payment_wizard_views.xml index 0a0c3da9..0a367f68 100644 --- a/account_payment_disperse/wizard/register_payment_wizard_views.xml +++ b/account_payment_disperse/wizard/register_payment_wizard_views.xml @@ -23,7 +23,7 @@ - + diff --git a/external/hibou-oca/account-analytic b/external/hibou-oca/account-analytic index 7e06779e..496db65e 160000 --- a/external/hibou-oca/account-analytic +++ b/external/hibou-oca/account-analytic @@ -1 +1 @@ -Subproject commit 7e06779e239d05bdeeccd52ac3de21942ef2b48b +Subproject commit 496db65e9d05780885adb7d89a4391364cef66f3 diff --git a/external/hibou-oca/bank-payment b/external/hibou-oca/bank-payment index c7630c7f..634492de 160000 --- a/external/hibou-oca/bank-payment +++ b/external/hibou-oca/bank-payment @@ -1 +1 @@ -Subproject commit c7630c7f853f7ff9431459fff2d8cdede58cc692 +Subproject commit 634492de89f36036b5efa57efaf13c2fc3e1b7ad diff --git a/external/hibou-oca/connector b/external/hibou-oca/connector index 5c3a125d..601f0dbd 160000 --- a/external/hibou-oca/connector +++ b/external/hibou-oca/connector @@ -1 +1 @@ -Subproject commit 5c3a125d6a51b241bd2e0a20119824a24f0863e4 +Subproject commit 601f0dbda30d836db3fa4fc88377a5b1e8a45970 diff --git a/external/hibou-oca/connector-ecommerce b/external/hibou-oca/connector-ecommerce index dbc8fbf1..de8c1911 160000 --- a/external/hibou-oca/connector-ecommerce +++ b/external/hibou-oca/connector-ecommerce @@ -1 +1 @@ -Subproject commit dbc8fbf136c98f4a06a249d78c3ffbcd2a7117ae +Subproject commit de8c1911b1b8038ddc682bc0b6a90341efe8246c diff --git a/external/hibou-oca/connector-magento b/external/hibou-oca/connector-magento index d1b99167..8cce7538 160000 --- a/external/hibou-oca/connector-magento +++ b/external/hibou-oca/connector-magento @@ -1 +1 @@ -Subproject commit d1b991671d0b0daae301288b47859eabd1a5794e +Subproject commit 8cce7538e6f81adc8411288430a350e98ef1349a diff --git a/external/hibou-oca/product-attribute b/external/hibou-oca/product-attribute index 6d906de3..b89f3a71 160000 --- a/external/hibou-oca/product-attribute +++ b/external/hibou-oca/product-attribute @@ -1 +1 @@ -Subproject commit 6d906de3bd0eb4f808bf37619196305c85bc56fa +Subproject commit b89f3a7199bb5baa52f782c0e809884daef70986 diff --git a/external/hibou-oca/queue b/external/hibou-oca/queue index 9d3c193e..56e8abbd 160000 --- a/external/hibou-oca/queue +++ b/external/hibou-oca/queue @@ -1 +1 @@ -Subproject commit 9d3c193e62c8aa64d63496ae79e18b3b53bba95e +Subproject commit 56e8abbd2440fd4550cd92830e803747fdf6b96c diff --git a/external/hibou-oca/sale-workflow b/external/hibou-oca/sale-workflow index df8c964e..4e3a5a0f 160000 --- a/external/hibou-oca/sale-workflow +++ b/external/hibou-oca/sale-workflow @@ -1 +1 @@ -Subproject commit df8c964e79e3e538db23190e2befdc59fad52838 +Subproject commit 4e3a5a0f902d4dd3a63b6aa00d05e00f323644de diff --git a/external/hibou-oca/server-tools b/external/hibou-oca/server-tools index 4bd10c59..dab39ca5 160000 --- a/external/hibou-oca/server-tools +++ b/external/hibou-oca/server-tools @@ -1 +1 @@ -Subproject commit 4bd10c59461bca2a0b8afd9028ac888b53cc5eef +Subproject commit dab39ca53c7e8f13079ee2dfeade2018373b91d7 diff --git a/external/hibou-shipbox b/external/hibou-shipbox new file mode 160000 index 00000000..61ec9b25 --- /dev/null +++ b/external/hibou-shipbox @@ -0,0 +1 @@ +Subproject commit 61ec9b25ab72d096e5f67efb06085bc5a3097636 diff --git a/hr_workers_comp_payroll/__manifest__.py b/hr_workers_comp_payroll/__manifest__.py index 2ccbb78d..0bdaaa76 100755 --- a/hr_workers_comp_payroll/__manifest__.py +++ b/hr_workers_comp_payroll/__manifest__.py @@ -3,7 +3,10 @@ 'author': 'Hibou Corp. ', 'license': 'AGPL-3', 'category': 'Human Resources', - 'depends': ['hr_contract'], + 'depends': [ + 'hr_payroll', + 'hr_workers_comp', + ], 'version': '11.0.0.0.0', 'description': """ Workers' Compensation Class - Payroll diff --git a/l10n_us_hr_payroll/__manifest__.py b/l10n_us_hr_payroll/__manifest__.py index d9201dff..50ab5121 100755 --- a/l10n_us_hr_payroll/__manifest__.py +++ b/l10n_us_hr_payroll/__manifest__.py @@ -5,7 +5,7 @@ 'license': 'AGPL-3', 'category': 'Localization', 'depends': ['hr_payroll'], - 'version': '11.0.2017.0.0', + 'version': '11.0.2018.1.0', 'description': """ USA Payroll Rules. ================== diff --git a/l10n_us_hr_payroll/data/rules_2018.xml b/l10n_us_hr_payroll/data/rules_2018.xml index a774ae09..8eb537ac 100755 --- a/l10n_us_hr_payroll/data/rules_2018.xml +++ b/l10n_us_hr_payroll/data/rules_2018.xml @@ -10,7 +10,7 @@ FICA Employee Social Security Wages (2018) FICA_EMP_SS_WAGES_2018 python - result = (payslip.date_to[:4] == '2018') + result = (payslip.date_to[:4] == '2018') and not contract.fica_exempt code ### @@ -32,7 +32,7 @@ else: FICA Employee Medicare Wages (2018) FICA_EMP_M_WAGES_2018 python - result = (payslip.date_to[:4] == '2018') + result = (payslip.date_to[:4] == '2018') and not contract.fica_exempt code result = categories.GROSS @@ -43,7 +43,7 @@ else: FICA Employee Medicare Additional Wages (2018) FICA_EMP_M_ADD_WAGES_2018 python - result = (payslip.date_to[:4] == '2018') + result = (payslip.date_to[:4] == '2018') and not contract.fica_exempt code ### diff --git a/l10n_us_hr_payroll/l10n_us_hr_payroll.py b/l10n_us_hr_payroll/l10n_us_hr_payroll.py index 68099b6e..a60fe555 100755 --- a/l10n_us_hr_payroll/l10n_us_hr_payroll.py +++ b/l10n_us_hr_payroll/l10n_us_hr_payroll.py @@ -26,6 +26,8 @@ class USHrContract(models.Model): external_wages = fields.Float(string='External Existing Wages', default=0.0) + fica_exempt = fields.Boolean(string='FICA Exempt', help="Exempt from Social Security and " + "Medicare e.g. F1 Student Visa") futa_type = fields.Selection([ (FUTA_TYPE_EXEMPT, 'Exempt (0%)'), (FUTA_TYPE_NORMAL, 'Normal Net Rate (0.6%)'), diff --git a/l10n_us_hr_payroll/l10n_us_hr_payroll_view.xml b/l10n_us_hr_payroll/l10n_us_hr_payroll_view.xml index 962c0909..257508bc 100755 --- a/l10n_us_hr_payroll/l10n_us_hr_payroll_view.xml +++ b/l10n_us_hr_payroll/l10n_us_hr_payroll_view.xml @@ -20,6 +20,7 @@ + diff --git a/l10n_us_hr_payroll/tests/test_us_payslip_2018.py b/l10n_us_hr_payroll/tests/test_us_payslip_2018.py index 9e676218..341dd803 100755 --- a/l10n_us_hr_payroll/tests/test_us_payslip_2018.py +++ b/l10n_us_hr_payroll/tests/test_us_payslip_2018.py @@ -342,3 +342,27 @@ class TestUsPayslip2018(TestUsPayslip): if 'FED_INC_WITHHOLD' in cats: fed_inc_withhold = cats['FED_INC_WITHHOLD'] self.assertPayrollEqual(fed_inc_withhold, 0.0) + + def test_2018_taxes_with_fica_exempt(self): + salary = 6000.0 + schedule_pay = 'bi-weekly' + w4_allowances = 2 + employee = self._createEmployee() + contract = self._createContract(employee, salary, schedule_pay, w4_allowances) + contract.fica_exempt = True + + self._log('2018 tax w4 exempt payslip:') + payslip = self._createPayslip(employee, '2018-01-01', '2018-01-31') + + payslip.compute_sheet() + + cats = self._getCategories(payslip) + + ss_wages = cats.get('FICA_EMP_SS_WAGES', 0.0) + med_wages = cats.get('FICA_EMP_M_WAGES', 0.0) + ss = cats.get('FICA_EMP_SS', 0.0) + med = cats.get('FICA_EMP_M', 0.0) + self.assertPayrollEqual(ss_wages, 0.0) + self.assertPayrollEqual(med_wages, 0.0) + self.assertPayrollEqual(ss, 0.0) + self.assertPayrollEqual(med, 0.0) diff --git a/l10n_us_partner_zipcode/__init__.py b/l10n_us_partner_zipcode/__init__.py new file mode 100644 index 00000000..91fed54d --- /dev/null +++ b/l10n_us_partner_zipcode/__init__.py @@ -0,0 +1 @@ +from . import res_partner diff --git a/l10n_us_partner_zipcode/__manifest__.py b/l10n_us_partner_zipcode/__manifest__.py new file mode 100644 index 00000000..d2461c7d --- /dev/null +++ b/l10n_us_partner_zipcode/__manifest__.py @@ -0,0 +1,37 @@ +{ + 'name': 'US ZIP Code to City/State', + 'summary': 'Determines the City and State from a provided ZIP code.', + 'version': '11.0.1.0.0', + 'author': "Hibou Corp.", + 'category': 'Localization', + 'license': 'AGPL-3', + 'complexity': 'easy', + 'images': [], + 'website': "https://hibou.io", + 'description': """ +US ZIP Code to City/State +========================= + +Determines the City and State from a provided ZIP code. Requires the `uszipcode` python package. + +Does not require `base_geolocalize`, but will fill the related fields if possible. + + +Contributors +------------ + +* Jared Kipe + +""", + 'depends': [ + 'base', + ], + 'external_dependencies': { + 'python': ['uszipcode'] + }, + 'demo': [], + 'data': [ + ], + 'auto_install': False, + 'installable': True, +} diff --git a/l10n_us_partner_zipcode/res_partner.py b/l10n_us_partner_zipcode/res_partner.py new file mode 100644 index 00000000..d21924d7 --- /dev/null +++ b/l10n_us_partner_zipcode/res_partner.py @@ -0,0 +1,39 @@ +import logging + +_logger = logging.getLogger(__name__) + +try: + from uszipcode import ZipcodeSearchEngine +except ImportError: + _logger.warn('module "uszipcode" cannot be loaded, you will be unable to detect Cities and States by ZIP') + ZipcodeSearchEngine = None + +from odoo import api, fields, models + + +class Partner(models.Model): + _inherit = 'res.partner' + + @api.onchange('zip') + def _zip_to_city_state(self): + if ZipcodeSearchEngine and self.zip and not self.city: + country_us = self.env['res.country'].search([('code', '=', 'US')], limit=1) + state_obj = self.env['res.country.state'] + if not self.country_id or self.country_id.id == country_us.id: + with ZipcodeSearchEngine() as search: + zipcode = search.by_zipcode(self.zip) + if zipcode: + if not self.country_id: + self.country_id = country_us + + self.city = zipcode['City'] + self.state_id = state_obj.search([ + ('code', '=', zipcode['State']), + ('country_id', '=', country_us.id), + ], limit=1) + + if hasattr(self, 'partner_latitude') and not self.partner_latitude: + self.partner_latitude = zipcode['Latitude'] + self.partner_longitude = zipcode['Longitude'] + self.date_localization = fields.Date.context_today(self) + return {} diff --git a/purchase_by_sale_history/__init__.py b/purchase_by_sale_history/__init__.py new file mode 100755 index 00000000..40272379 --- /dev/null +++ b/purchase_by_sale_history/__init__.py @@ -0,0 +1 @@ +from . import wizard diff --git a/purchase_by_sale_history/__manifest__.py b/purchase_by_sale_history/__manifest__.py new file mode 100755 index 00000000..65eb47a8 --- /dev/null +++ b/purchase_by_sale_history/__manifest__.py @@ -0,0 +1,21 @@ +{ + 'name': 'Purchase by Sale History', + 'author': 'Hibou Corp. ', + 'version': '11.0.1.0.0', + 'category': 'Purchases', + 'sequence': 95, + 'summary': 'Fill Purchase Orders by Sales History', + 'description': """ +Adds wizard to Purchase Orders that will fill the purchase order with products based on sales history. + """, + 'website': 'https://hibou.io/', + 'depends': [ + 'sale_stock', + 'purchase', + ], + 'data': [ + 'wizard/purchase_by_sale_history_views.xml', + ], + 'installable': True, + 'application': False, +} diff --git a/purchase_by_sale_history/tests/__init__.py b/purchase_by_sale_history/tests/__init__.py new file mode 100644 index 00000000..6cc4addf --- /dev/null +++ b/purchase_by_sale_history/tests/__init__.py @@ -0,0 +1 @@ +from . import test_purchase_by_sale_history diff --git a/purchase_by_sale_history/tests/test_purchase_by_sale_history.py b/purchase_by_sale_history/tests/test_purchase_by_sale_history.py new file mode 100644 index 00000000..3152bef9 --- /dev/null +++ b/purchase_by_sale_history/tests/test_purchase_by_sale_history.py @@ -0,0 +1,133 @@ +from odoo import fields +from odoo.tests import common +from datetime import datetime, timedelta + + +class TestPurchaseBySaleHistory(common.TransactionCase): + + def test_00_wizard(self): + sale_partner = self.env.ref('base.res_partner_2') + purchase_partner = self.env['res.partner'].create({ + 'name': 'Purchase Partner', + }) + + product11 = self.env['product.product'].create({ + 'name': 'Product 1', + 'type': 'product', + }) + product12 = self.env['product.product'].create({ + 'name': 'Product 1.1', + 'type': 'product', + 'product_tmpl_id': product11.product_tmpl_id.id, + }) + product2 = self.env['product.product'].create({ + 'name': 'Product 2', + 'type': 'product', + }) + + po1 = self.env['purchase.order'].create({ + 'partner_id': purchase_partner.id, + }) + + # Create initial wizard, it won't apply to any products because the PO is empty, and the vendor + # doesn't supply any products yet. + wiz = self.env['purchase.sale.history.make'].create({ + 'purchase_id': po1.id, + }) + + self.assertEqual(wiz.product_count, 0.0, 'There shouldn\'t be any products for this vendor yet.') + + # Assign vendor to products created earlier. + self.env['product.supplierinfo'].create({ + 'name': purchase_partner.id, + 'product_tmpl_id': product11.product_tmpl_id.id, + 'product_id': product11.id, + }) + self.env['product.supplierinfo'].create({ + 'name': purchase_partner.id, + 'product_tmpl_id': product2.product_tmpl_id.id, + }) + # New wizard picks up the correct number of products supplied by this vendor. + wiz = self.env['purchase.sale.history.make'].create({ + 'purchase_id': po1.id, + }) + self.assertEqual(wiz.product_count, 2) + + # Make some sales history... + sale_date = fields.Datetime.to_string(datetime.now() - timedelta(days=30)) + self.env['sale.order'].create({ + 'partner_id': sale_partner.id, + 'date_order': sale_date, + 'confirmation_date': sale_date, + 'picking_policy': 'direct', + 'order_line': [ + (0, 0, {'product_id': product11.id, 'product_uom_qty': 3.0}), + (0, 0, {'product_id': product12.id, 'product_uom_qty': 3.0}), + (0, 0, {'product_id': product2.id, 'product_uom_qty': 3.0}), + ], + }).action_confirm() + + days = 60 + history_start = fields.Date.to_string(datetime.now() - timedelta(days=days)) + history_end = fields.Date.today() + wiz.write({ + 'history_start': history_start, + 'history_end': history_end, + 'procure_days': days, + }) + self.assertEqual(wiz.history_days, days) + wiz.action_confirm() + self.assertEqual(po1.order_line.filtered(lambda l: l.product_id == product11).product_qty, 3.0) + self.assertEqual(po1.order_line.filtered(lambda l: l.product_id == product12).product_qty, 0.0) + self.assertEqual(po1.order_line.filtered(lambda l: l.product_id == product2).product_qty, 3.0) + + # Make additional sales history... + sale_date = fields.Datetime.to_string(datetime.now() - timedelta(days=15)) + self.env['sale.order'].create({ + 'partner_id': sale_partner.id, + 'date_order': sale_date, + 'confirmation_date': sale_date, + 'picking_policy': 'direct', + 'order_line': [ + (0, 0, {'product_id': product11.id, 'product_uom_qty': 3.0}), + (0, 0, {'product_id': product12.id, 'product_uom_qty': 3.0}), + (0, 0, {'product_id': product2.id, 'product_uom_qty': 3.0}), + ], + }).action_confirm() + + wiz.action_confirm() + self.assertEqual(po1.order_line.filtered(lambda l: l.product_id == product11).product_qty, 6.0) + self.assertEqual(po1.order_line.filtered(lambda l: l.product_id == product12).product_qty, 0.0) + self.assertEqual(po1.order_line.filtered(lambda l: l.product_id == product2).product_qty, 6.0) + + # Make additional sales history that should NOT be counted... + sale_date = fields.Datetime.to_string(datetime.now() - timedelta(days=61)) + self.env['sale.order'].create({ + 'partner_id': sale_partner.id, + 'date_order': sale_date, + 'confirmation_date': sale_date, + 'picking_policy': 'direct', + 'order_line': [ + (0, 0, {'product_id': product11.id, 'product_uom_qty': 3.0}), + (0, 0, {'product_id': product12.id, 'product_uom_qty': 3.0}), + (0, 0, {'product_id': product2.id, 'product_uom_qty': 3.0}), + ], + }).action_confirm() + + wiz.action_confirm() + self.assertEqual(po1.order_line.filtered(lambda l: l.product_id == product11).product_qty, 6.0) + self.assertEqual(po1.order_line.filtered(lambda l: l.product_id == product12).product_qty, 0.0) + self.assertEqual(po1.order_line.filtered(lambda l: l.product_id == product2).product_qty, 6.0) + + # Test that the wizard will only use the existing PO line products now that we have lines. + po1.order_line.filtered(lambda l: l.product_id == product2).unlink() + wiz.action_confirm() + self.assertEqual(po1.order_line.filtered(lambda l: l.product_id == product11).product_qty, 6.0) + self.assertEqual(po1.order_line.filtered(lambda l: l.product_id == product12).product_qty, 0.0) + self.assertEqual(po1.order_line.filtered(lambda l: l.product_id == product2).product_qty, 0.0) + + # Plan for 1/2 the days of inventory + wiz.procure_days = days / 2.0 + wiz.action_confirm() + self.assertEqual(po1.order_line.filtered(lambda l: l.product_id == product11).product_qty, 6.0 / 2.0) + diff --git a/purchase_by_sale_history/wizard/__init__.py b/purchase_by_sale_history/wizard/__init__.py new file mode 100644 index 00000000..bbdff949 --- /dev/null +++ b/purchase_by_sale_history/wizard/__init__.py @@ -0,0 +1 @@ +from . import purchase_by_sale_history diff --git a/purchase_by_sale_history/wizard/purchase_by_sale_history.py b/purchase_by_sale_history/wizard/purchase_by_sale_history.py new file mode 100644 index 00000000..fb1e6d30 --- /dev/null +++ b/purchase_by_sale_history/wizard/purchase_by_sale_history.py @@ -0,0 +1,100 @@ +from odoo import api, fields, models +from math import ceil +from datetime import timedelta + + +class PurchaseBySaleHistory(models.TransientModel): + _name = 'purchase.sale.history.make' + + purchase_id = fields.Many2one('purchase.order', string='Purchase Order') + history_start = fields.Date(string='Sales History Start', default=lambda o: fields.Date.from_string(fields.Date.today()) - timedelta(days=30)) + history_end = fields.Date(string='Sales History End', default=fields.Date.today) + history_days = fields.Integer(string='Sales History Days', compute='_compute_history_days') + procure_days = fields.Integer(string='Days to Procure', + default=30, + help='History will be computed as an average per day, ' + 'and then multiplied by the days you wish to procure for.') + product_count = fields.Integer(string='Product Count', compute='_compute_product_count', + help='Products on the PO or that the Vendor provides.') + + @api.multi + @api.depends('history_start', 'history_end') + def _compute_history_days(self): + for wiz in self: + if not all((wiz.history_end, wiz.history_start)): + wiz.history_days = 0 + else: + delta = fields.Date.from_string(wiz.history_end) - fields.Date.from_string(wiz.history_start) + wiz.history_days = delta.days + + @api.multi + @api.depends('purchase_id', 'purchase_id.order_line', 'purchase_id.partner_id') + def _compute_product_count(self): + for wiz in self: + if wiz.purchase_id.order_line: + wiz.product_count = len(set(wiz.purchase_id.order_line.mapped('product_id.id'))) + elif wiz.purchase_id.partner_id: + self.env.cr.execute("""SELECT COUNT(DISTINCT(psi.product_id)) + COUNT(DISTINCT(p.id)) + FROM product_supplierinfo psi + LEFT JOIN product_product p ON p.product_tmpl_id = psi.product_tmpl_id AND psi.product_id IS NULL + WHERE psi.name = %d;""" + % (wiz.purchase_id.partner_id.id, )) + wiz.product_count = self.env.cr.fetchall()[0][0] + + def _history_product_ids(self): + if self.purchase_id.order_line: + return self.purchase_id.order_line.mapped('product_id.id') + + self.env.cr.execute("""SELECT DISTINCT(COALESCE(psi.product_id, p.id)) + FROM product_supplierinfo psi + LEFT JOIN product_product p ON p.product_tmpl_id = psi.product_tmpl_id AND psi.product_id IS NULL + WHERE psi.name = %d;""" + % (self.purchase_id.partner_id.id, )) + rows = self.env.cr.fetchall() + return [r[0] for r in rows if r[0]] + + def _sale_history(self, product_ids): + self.env.cr.execute("""SELECT product_id, sum(product_uom_qty) + FROM sale_report + WHERE date BETWEEN %s AND %s AND product_id IN %s + GROUP BY 1""", (self.history_start, self.history_end, tuple(product_ids))) + return self.env.cr.fetchall() + + def _apply_history(self, history): + line_model = self.env['purchase.order.line'] + updated_lines = line_model.browse() + for pid, sold_qty in history: + # TODO: Should convert from Sale UOM to Purchase UOM + qty = ceil(sold_qty * self.procure_days / self.history_days) + # Find line that already exists on PO + line = self.purchase_id.order_line.filtered(lambda l: l.product_id.id == pid) + if line: + line.write({'product_qty': qty}) + line._onchange_quantity() + else: + # Create new PO line + line = line_model.new({ + 'order_id': self.purchase_id.id, + 'product_id': pid, + 'product_qty': qty, + }) + line.onchange_product_id() + line_vals = line._convert_to_write(line._cache) + line_vals['product_qty'] = qty + line = line_model.create(line_vals) + updated_lines += line + + # Lines not touched should now not be ordered. + other_lines = self.purchase_id.order_line - updated_lines + other_lines.write({'product_qty': 0.0}) + for line in other_lines: + line._onchange_quantity() + + @api.multi + def action_confirm(self): + self.ensure_one() + history_product_ids = self._history_product_ids() + history = self._sale_history(history_product_ids) + self._apply_history(history) + + diff --git a/purchase_by_sale_history/wizard/purchase_by_sale_history_views.xml b/purchase_by_sale_history/wizard/purchase_by_sale_history_views.xml new file mode 100644 index 00000000..2841283e --- /dev/null +++ b/purchase_by_sale_history/wizard/purchase_by_sale_history_views.xml @@ -0,0 +1,52 @@ + + + + purchase.sale.history.make.form + purchase.sale.history.make + +
+ + + + + + + + + + + + + + + +
+
+
+
+
+ + + Fill PO From Sales History + purchase.sale.history.make + form + form + + new + {'default_purchase_id': active_id} + + + + + purchase.order.form.inherit + purchase.order + + + + + +
+

+ +

+
+ + + + + +
+ +
+ + +
+