[PATCH] Upstream patch - 19072023

This commit is contained in:
Parthiv Patel
2023-07-19 08:33:54 +00:00
parent b929d1a8ea
commit b673c6f26e
12 changed files with 111 additions and 9 deletions
+12 -4
View File
@@ -55,7 +55,9 @@
<span t-field="o.partner_bank_id.acc_number"/><br/>
<span t-esc="o.partner_bank_id.acc_holder_name or o.company_id.name"/><br/>
<span t-field="o.company_id.street"/><br/>
<span t-field="o.company_id.country_id.code"/>
<t t-if="o.company_id.country_id.code != 'CH'">
<span t-field="o.company_id.country_id.code"/>
</t>
<span t-field="o.company_id.zip"/>
<span t-field="o.company_id.city"/><br/>
<br/>
@@ -86,7 +88,9 @@
<span t-field="o.partner_id.commercial_partner_id.name"/><br/>
<span t-field="o.partner_id.street"/>
<span t-field="o.partner_id.street2"/><br/>
<span t-field="o.partner_id.country_id.code"/>
<t t-if="o.partner_id.country_id.code != 'CH'">
<span t-field="o.partner_id.country_id.code"/>
</t>
<span t-field="o.partner_id.zip"/>
<span t-field="o.partner_id.city"/>
</div>
@@ -165,7 +169,9 @@
<span t-field="o.partner_bank_id.acc_number"/><br/>
<span t-esc="o.partner_bank_id.acc_holder_name or o.company_id.name"/><br/>
<span t-field="o.company_id.street"/><br/>
<span t-field="o.company_id.country_id.code"/>
<t t-if="o.company_id.country_id.code != 'CH'">
<span t-field="o.company_id.country_id.code"/>
</t>
<span t-field="o.company_id.zip"/>
<span t-field="o.company_id.city"/><br/>
<br/>
@@ -207,7 +213,9 @@
<span t-field="o.partner_id.commercial_partner_id.name"/><br/>
<span t-field="o.partner_id.street"> </span>
<span t-field="o.partner_id.street2"/><br/>
<span t-field="o.partner_id.country_id.code"/>
<t t-if="o.partner_id.country_id.code != 'CH'">
<span t-field="o.partner_id.country_id.code"/>
</t>
<span t-field="o.partner_id.zip"/>
<span t-field="o.partner_id.city"/><br/>
<br/>
+32
View File
@@ -2522,6 +2522,38 @@
}),
]"/>
</record>
<record id="account_tax_template_p_iva5_nd" model="account.tax.template">
<field name="type_tax_use">purchase</field>
<field name="name">5% IVA Soportado no deducible</field>
<field name="chart_template_id" ref="l10n_es.account_chart_template_common"/>
<field name="amount" eval="5"/>
<field name="amount_type">percent</field>
<field name="analytic" eval="True"/>
<field name="tax_group_id" ref="tax_group_iva_nd"/>
<field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
(0,0, {
'factor_percent': 100,
'repartition_type': 'base',
}),
(0,0, {
'factor_percent': 100,
'repartition_type': 'tax',
}),
]"/>
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
(0,0, {
'factor_percent': 100,
'repartition_type': 'base',
}),
(0,0, {
'factor_percent': 100,
'repartition_type': 'tax',
}),
]"/>
</record>
<record id="account_tax_template_p_iva4_nd" model="account.tax.template">
<field name="type_tax_use">purchase</field>
<field name="name">4% IVA Soportado no deducible</field>
@@ -194,6 +194,10 @@
<field name="name">10% IVA Soportado no deducible</field>
<field name="l10n_es_type">no_deducible</field>
</record>
<record id="l10n_es.account_tax_template_p_iva5_nd" model="account.tax.template">
<field name="name">5% IVA Soportado no deducible</field>
<field name="l10n_es_type">no_deducible</field>
</record>
<record id="l10n_es.account_tax_template_p_iva4_nd" model="account.tax.template">
<field name="name">4% IVA Soportado no deducible</field>
<field name="l10n_es_type">no_deducible</field>
+17
View File
@@ -24,6 +24,23 @@ class TestAccountFrFec(AccountTestInvoicingCommon):
lines_data = [(1437.12, 'Hello\tDarkness'), (1676.64, 'my\rold\nfriend'), (3353.28, '\t\t\r')]
today = fields.Date.today().strftime('%Y-%m-%d')
cls.tax_sale_a = cls.env['account.tax'].create({
'name': "TVA 20,0%",
'amount_type': 'percent',
'type_tax_use': 'sale',
'amount': 20,
'invoice_repartition_line_ids': [
(0, 0, {
'factor_percent': 100,
'repartition_type': 'base',
}),
(0, 0, {
'repartition_type': 'tax',
'factor_percent': 100,
'account_id': cls.env['account.account'].search([('code', '=', "445710")], limit=1).id,
})
]
})
cls.invoice_a = cls.env['account.move'].create({
'move_type': 'out_invoice',
'partner_id': cls.partner_a.id,
+6
View File
@@ -83,3 +83,9 @@ class MrpRoutingWorkcenter(models.Model):
return False
self.ensure_one()
return tuple(self[key] for key in ('name', 'company_id', 'workcenter_id', 'time_mode', 'time_cycle_manual'))
def write(self, values):
if 'bom_id' in values:
filtered_lines = self.bom_id.bom_line_ids.filtered(lambda line: line.operation_id == self)
filtered_lines.operation_id = False
return super().write(values)
+23
View File
@@ -979,3 +979,26 @@ class TestBoM(TestMrpCommon):
self.assertEqual(p1.qty_available, 5.0)
self.assertEqual(p2.qty_available, 10.0)
self.assertEqual(p3.qty_available, 10.0)
def test_update_bom_in_routing_workcenter(self):
"""
This test checks the behaviour of updating the BoM associated with a routing workcenter,
It verifies that the link between the BOM lines and the operation is correctly deleted.
"""
p1, c1, c2 = self.make_prods(3)
bom = self.env['mrp.bom'].create({
'product_tmpl_id': p1.product_tmpl_id.id,
'product_qty': 1.0,
'bom_line_ids': [(0, 0, {'product_id': c1.id, 'product_qty': 1.0}),
(0, 0, {'product_id': c2.id, 'product_qty': 1.0})],
})
operation = self.env['mrp.routing.workcenter'].create({
'name': 'Operation',
'workcenter_id': self.env.ref('mrp.mrp_workcenter_1').id,
'bom_id': bom.id,
})
bom.bom_line_ids.operation_id = operation
self.assertEqual(operation.bom_id, bom)
operation.bom_id = self.bom_1
self.assertEqual(operation.bom_id, self.bom_1)
self.assertFalse(bom.bom_line_ids.operation_id)
+1 -1
View File
@@ -80,7 +80,7 @@
<button name="button_scrap" type="object" string="Scrap" attrs="{'invisible': [('state', 'in', ('cancel', 'draft'))]}"/>
<field name="state" widget="statusbar" statusbar_visible="draft,confirmed,progress,done"/>
<button name="action_toggle_is_locked" attrs="{'invisible': ['|', ('show_lock', '=', False), ('is_locked', '=', False)]}" string="Unlock" groups="mrp.group_mrp_manager" type="object" help="Unlock the manufacturing order to adjust what has been consumed or produced."/>
<button name="action_toggle_is_locked" attrs="{'invisible': ['|', ('show_lock', '=', False), ('is_locked', '=', True)]}" string="Lock" groups="mrp.group_mrp_manager" type="object" help="Lock the manufacturing order to prevent changes to what has been consumed or produced."/>/>
<button name="action_toggle_is_locked" attrs="{'invisible': ['|', ('show_lock', '=', False), ('is_locked', '=', True)]}" string="Lock" groups="mrp.group_mrp_manager" type="object" help="Lock the manufacturing order to prevent changes to what has been consumed or produced."/>
<button name="action_cancel" type="object" string="Cancel"
attrs="{'invisible': ['|', '|', ('id', '=', False), ('state', 'in', ('done', 'cancel')), ('confirm_cancel', '=', True)]}"/>
<button name="action_cancel" type="object" string="Cancel"
+1 -1
View File
@@ -473,7 +473,7 @@
<field name="name">purchase.order.kanban</field>
<field name="model">purchase.order</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile" js_class="purchase_kanban_dashboard" sample="1">
<kanban class="o_kanban_mobile" js_class="purchase_kanban_dashboard" sample="1" quick_create="false">
<field name="name"/>
<field name="partner_id" readonly="1"/>
<field name="amount_total"/>
+1 -1
View File
@@ -58,7 +58,7 @@ class SaleOrder(models.Model):
'search_default_billable_timesheet': True
} # erase default filters
if self.timesheet_count > 0:
action['domain'] = [('so_line', 'in', self.order_line.ids)]
action['domain'] = [('so_line', 'in', self.order_line.ids), ('project_id', '!=', False)]
else:
action = {'type': 'ir.actions.act_window_close'}
return action
+1 -1
View File
@@ -26,7 +26,7 @@ class ProductionLot(models.Model):
product_qty = fields.Float('Quantity', compute='_product_qty')
note = fields.Html(string='Description')
display_complete = fields.Boolean(compute='_compute_display_complete')
company_id = fields.Many2one('res.company', 'Company', required=True, store=True, index=True)
company_id = fields.Many2one('res.company', 'Company', required=True, store=True, index=True, default=lambda self: self.env.company.id)
@api.constrains('name', 'product_id', 'company_id')
def _check_unique_lot(self):
+1 -1
View File
@@ -46,7 +46,7 @@ class StockMove(models.Model):
layers = layers.filtered(lambda l: float_compare(l.value, 0, precision_rounding=l.product_id.uom_id.rounding) <= 0)
layers |= layers.stock_valuation_layer_ids
quantity = sum(layers.mapped("quantity"))
return layers.currency_id.round(sum(layers.mapped("value")) / quantity) if not float_is_zero(quantity, precision_rounding=layers.uom_id.rounding) else 0
return sum(layers.mapped("value")) / quantity if not float_is_zero(quantity, precision_rounding=layers.uom_id.rounding) else 0
return price_unit if not float_is_zero(price_unit, precision) or self._should_force_price_unit() else self.product_id.standard_price
@api.model
@@ -580,6 +580,18 @@ class TestStockValuationAVCO(TestStockValuationCommon):
self.assertEqual(self.product1.quantity_svl, 10)
self.assertEqual(self.product1.standard_price, 2)
def test_return_delivery_rounding(self):
self.product1.product_tmpl_id.categ_id.property_valuation = 'manual_periodic'
self.product1.write({"standard_price": 1})
self._make_in_move(self.product1, 1, unit_cost=13.13)
self._make_in_move(self.product1, 1, unit_cost=12.20)
move3 = self._make_out_move(self.product1, 2, create_picking=True)
move4 = self._make_return(move3, 2)
self.assertAlmostEqual(abs(move3.stock_valuation_layer_ids[0].value), abs(move4.stock_valuation_layer_ids[0].value))
self.assertAlmostEqual(self.product1.value_svl, 25.33)
self.assertEqual(self.product1.quantity_svl, 2)
class TestStockValuationFIFO(TestStockValuationCommon):
def setUp(self):