mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2026-08-17 16:54:42 -05:00
[PATCH] Upstream patch - 10022022
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
<field name="description">IVA23 (taxa normal Portugal Continental)</field>
|
||||
<field name="amount">23</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="tax_group_id" ref="tax_group_iva_23"/>
|
||||
<field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
|
||||
(0,0, {
|
||||
@@ -18,6 +19,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -29,6 +31,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -38,6 +41,7 @@
|
||||
<field name="name">IVA22</field>
|
||||
<field name="description">IVA22 (taxa normal Madeira)</field>
|
||||
<field name="amount">22</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="tax_group_id" ref="tax_group_iva_22"/>
|
||||
<field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -49,6 +53,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -60,6 +65,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -69,6 +75,7 @@
|
||||
<field name="name">IVA16</field>
|
||||
<field name="description">IVA16 (taxa normal Açores)</field>
|
||||
<field name="amount">16</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="tax_group_id" ref="tax_group_iva_16"/>
|
||||
<field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -80,6 +87,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -91,6 +99,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -100,6 +109,7 @@
|
||||
<field name="name">IVA13</field>
|
||||
<field name="description">IVA13 (taxa intermédia Portugal Continental)</field>
|
||||
<field name="amount">13</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="tax_group_id" ref="tax_group_iva_13"/>
|
||||
<field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -111,6 +121,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -122,6 +133,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -131,6 +143,7 @@
|
||||
<field name="name">IVA12</field>
|
||||
<field name="description">IVA12 (taxa intermédia Madeira)</field>
|
||||
<field name="amount">12</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="tax_group_id" ref="tax_group_iva_12"/>
|
||||
<field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -142,6 +155,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -153,6 +167,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -162,6 +177,7 @@
|
||||
<field name="name">IVA9</field>
|
||||
<field name="description">IVA9 (taxa intermédia Açores)</field>
|
||||
<field name="amount">9</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="tax_group_id" ref="tax_group_iva_9"/>
|
||||
<field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -173,6 +189,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -184,6 +201,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -193,6 +211,7 @@
|
||||
<field name="name">IVA6</field>
|
||||
<field name="description">IVA6 (taxa reduzida Portugal Continental)</field>
|
||||
<field name="amount">6</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="tax_group_id" ref="tax_group_iva_6"/>
|
||||
<field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -204,6 +223,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -215,6 +235,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -224,6 +245,7 @@
|
||||
<field name="name">IVA5</field>
|
||||
<field name="description">IVA5 (taxa reduzida Madeira)</field>
|
||||
<field name="amount">5</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="tax_group_id" ref="tax_group_iva_5"/>
|
||||
<field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -235,6 +257,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -246,6 +269,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -255,6 +279,7 @@
|
||||
<field name="name">IVA4</field>
|
||||
<field name="description">IVA4 (taxa reduzida Açores)</field>
|
||||
<field name="amount">4</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="tax_group_id" ref="tax_group_iva_4"/>
|
||||
<field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -266,6 +291,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -277,6 +303,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -286,6 +313,7 @@
|
||||
<field name="name">IVA0</field>
|
||||
<field name="description">IVA0</field>
|
||||
<field name="amount">0</field>
|
||||
<field name="type_tax_use">sale</field>
|
||||
<field name="amount_type">percent</field>
|
||||
<field name="tax_group_id" ref="tax_group_iva_0"/>
|
||||
<field name="invoice_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -297,6 +325,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -308,6 +337,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2433'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -329,6 +359,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -340,10 +371,11 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="compiva22" model="account.tax.template">
|
||||
<field name="chart_template_id" ref="pt_chart_template"/>
|
||||
<field name="name">IVA22 compra</field>
|
||||
@@ -361,6 +393,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -372,10 +405,11 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="compiva16" model="account.tax.template">
|
||||
<field name="chart_template_id" ref="pt_chart_template"/>
|
||||
<field name="name">IVA16 compra</field>
|
||||
@@ -393,6 +427,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -404,6 +439,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -425,6 +461,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -436,6 +473,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -457,6 +495,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -468,6 +507,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -489,6 +529,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -500,6 +541,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -521,6 +563,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -532,6 +575,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -553,6 +597,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -564,6 +609,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -585,6 +631,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -596,6 +643,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
@@ -617,6 +665,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
<field name="refund_repartition_line_ids" eval="[(5, 0, 0),
|
||||
@@ -628,6 +677,7 @@
|
||||
(0,0, {
|
||||
'factor_percent': 100,
|
||||
'repartition_type': 'tax',
|
||||
'account_id': ref('chart_2432'),
|
||||
}),
|
||||
]"/>
|
||||
</record>
|
||||
|
||||
@@ -99,7 +99,7 @@ class Meeting(models.Model):
|
||||
values = {
|
||||
**default_values,
|
||||
'name': microsoft_event.subject or _("(No title)"),
|
||||
'description': microsoft_event.bodyPreview,
|
||||
'description': microsoft_event.body['content'],
|
||||
'location': microsoft_event.location and microsoft_event.location.get('displayName') or False,
|
||||
'user_id': microsoft_event.owner(self.env).id,
|
||||
'privacy': sensitivity_o2m.get(microsoft_event.sensitivity, self.default_get(['privacy'])['privacy']),
|
||||
|
||||
@@ -33,7 +33,7 @@ class MicrosoftCalendarService():
|
||||
@requires_auth_token
|
||||
def get_events(self, sync_token=None, token=None, timeout=TIMEOUT):
|
||||
url = "/v1.0/me/calendarView/delta"
|
||||
headers = {'Content-type': 'application/json', 'Authorization': 'Bearer %s' % token, 'Prefer': 'odata.maxpagesize=50'}
|
||||
headers = {'Content-type': 'application/json', 'Authorization': 'Bearer %s' % token, 'Prefer': 'odata.maxpagesize=50,outlook.body-content-type="text"'}
|
||||
params = {}
|
||||
if sync_token:
|
||||
params['$deltatoken'] = sync_token
|
||||
|
||||
@@ -1418,6 +1418,9 @@ class MrpProduction(models.Model):
|
||||
|
||||
def _get_backorder_mo_vals(self):
|
||||
self.ensure_one()
|
||||
if not self.procurement_group_id:
|
||||
# in the rare case that the procurement group has been removed somehow, create a new one
|
||||
self.procurement_group_id = self.env["procurement.group"].create({'name': self.name})
|
||||
next_seq = max(self.procurement_group_id.mrp_production_ids.mapped("backorder_sequence"), default=1)
|
||||
return {
|
||||
'name': self._get_name_backorder(self.name, next_seq + 1),
|
||||
|
||||
@@ -78,6 +78,61 @@ class TestMrpProductionBackorder(TestMrpCommon):
|
||||
self.assertEqual(sum(mo_backorder.move_raw_ids.filtered(lambda m: m.product_id.id == product_to_use_1.id).mapped("product_uom_qty")), 9)
|
||||
self.assertEqual(mo_backorder.reserve_visible, False) # the reservation of the first MO should've been moved here
|
||||
|
||||
def test_backorder_and_orderpoint(self):
|
||||
""" Same as test_no_tracking_2, except one of components also has an orderpoint (i.e. reordering rule)
|
||||
and not enough components are in stock (i.e. so orderpoint is triggered)."""
|
||||
production, _, product_to_build, product_to_use_1, product_to_use_2 = self.generate_mo(qty_final=4, qty_base_1=1)
|
||||
|
||||
# Make some stock and reserve
|
||||
for product in production.move_raw_ids.product_id:
|
||||
self.env['stock.quant'].with_context(inventory_mode=True).create({
|
||||
'product_id': product.id,
|
||||
'inventory_quantity': 1,
|
||||
'location_id': production.location_src_id.id,
|
||||
})
|
||||
production.action_assign()
|
||||
|
||||
self.env['stock.warehouse.orderpoint'].create({
|
||||
'name': 'product_to_use_1 RR',
|
||||
'location_id': production.location_src_id.id,
|
||||
'product_id': product_to_use_1.id,
|
||||
'product_min_qty': 1,
|
||||
'product_max_qty': 5,
|
||||
})
|
||||
|
||||
self.env['mrp.bom'].create({
|
||||
'product_id': product_to_use_1.id,
|
||||
'product_tmpl_id': product_to_use_1.product_tmpl_id.id,
|
||||
'product_uom_id': product_to_use_1.uom_id.id,
|
||||
'product_qty': 1.0,
|
||||
'type': 'normal',
|
||||
'consumption': 'flexible',
|
||||
'bom_line_ids': [
|
||||
(0, 0, {'product_id': product_to_use_2.id, 'product_qty': 1.0})
|
||||
]})
|
||||
product_to_use_1.write({'route_ids': [(4, self.ref('mrp.route_warehouse0_manufacture'))]})
|
||||
|
||||
mo_form = Form(production)
|
||||
mo_form.qty_producing = 1
|
||||
production = mo_form.save()
|
||||
|
||||
action = production.button_mark_done()
|
||||
backorder = Form(self.env['mrp.production.backorder'].with_context(**action['context']))
|
||||
backorder.save().action_backorder()
|
||||
|
||||
# Two related MO, orig + backorder, in same the procurement group
|
||||
mos = self.env['mrp.production'].search([
|
||||
('product_id', '=', product_to_build.id),
|
||||
])
|
||||
self.assertEqual(len(mos), 2, "Backorder was not created.")
|
||||
self.assertEqual(len(production.procurement_group_id.mrp_production_ids), 2, "MO backorder not linked to original MO")
|
||||
|
||||
# Orderpoint MO is NOT part of procurement group
|
||||
mo_orderpoint = self.env['mrp.production'].search([
|
||||
('product_id', '=', product_to_use_1.id),
|
||||
])
|
||||
self.assertEqual(len(mo_orderpoint.procurement_group_id.mrp_production_ids), 1, "Reordering rule MO incorrectly linked to other MOs")
|
||||
|
||||
def test_no_tracking_pbm_1(self):
|
||||
"""Create a MO for 4 product. Produce 1. The backorder button should
|
||||
appear and hitting mark as done should open the backorder wizard. In the backorder
|
||||
|
||||
@@ -29,11 +29,13 @@ class MrpConsumptionWarning(models.TransientModel):
|
||||
wizard.consumption = "strict" in consumption_map and "strict" or "warning" in consumption_map and "warning" or "flexible"
|
||||
|
||||
def action_confirm(self):
|
||||
ctx = dict(self.env.context)
|
||||
ctx.pop('default_mrp_production_ids', None)
|
||||
action_from_do_finish = False
|
||||
if self.env.context.get('from_workorder'):
|
||||
if self.env.context.get('active_model') == 'mrp.workorder':
|
||||
action_from_do_finish = self.env['mrp.workorder'].browse(self.env.context.get('active_id')).do_finish()
|
||||
action_from_mark_done = self.mrp_production_ids.with_context(skip_consumption=True).button_mark_done()
|
||||
action_from_mark_done = self.mrp_production_ids.with_context(ctx, skip_consumption=True).button_mark_done()
|
||||
return action_from_do_finish or action_from_mark_done
|
||||
|
||||
def action_cancel(self):
|
||||
|
||||
@@ -34,5 +34,7 @@ class MrpProductionBackorder(models.TransientModel):
|
||||
return self.mrp_production_ids.with_context(skip_backorder=True).button_mark_done()
|
||||
|
||||
def action_backorder(self):
|
||||
ctx = dict(self.env.context)
|
||||
ctx.pop('default_mrp_production_ids', None)
|
||||
mo_ids_to_backorder = self.mrp_production_backorder_line_ids.filtered(lambda l: l.to_backorder).mrp_production_id.ids
|
||||
return self.mrp_production_ids.with_context(skip_backorder=True, mo_ids_to_backorder=mo_ids_to_backorder).button_mark_done()
|
||||
return self.mrp_production_ids.with_context(ctx, skip_backorder=True, mo_ids_to_backorder=mo_ids_to_backorder).button_mark_done()
|
||||
|
||||
@@ -112,7 +112,7 @@ class ProductProduct(models.Model):
|
||||
digits='Product Price',
|
||||
groups="base.group_user",
|
||||
help="""In Standard Price & AVCO: value of the product (automatically computed in AVCO).
|
||||
In FIFO: value of the last unit that left the stock (automatically computed).
|
||||
In FIFO: value of the next unit that will leave the stock (automatically computed).
|
||||
Used to value the product when the purchase cost is not known (e.g. inventory adjustment).
|
||||
Used to compute margins on sale orders.""")
|
||||
volume = fields.Float('Volume', digits='Volume')
|
||||
|
||||
@@ -79,7 +79,7 @@ class ProductTemplate(models.Model):
|
||||
inverse='_set_standard_price', search='_search_standard_price',
|
||||
digits='Product Price', groups="base.group_user",
|
||||
help="""In Standard Price & AVCO: value of the product (automatically computed in AVCO).
|
||||
In FIFO: value of the last unit that left the stock (automatically computed).
|
||||
In FIFO: value of the next unit that will leave the stock (automatically computed).
|
||||
Used to value the product when the purchase cost is not known (e.g. inventory adjustment).
|
||||
Used to compute margins on sale orders.""")
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import base64
|
||||
|
||||
from flectra import fields, models, api, _
|
||||
from flectra.addons.iap.tools import iap_tools
|
||||
from flectra.exceptions import AccessError
|
||||
from flectra.tools.safe_eval import safe_eval
|
||||
|
||||
DEFAULT_ENDPOINT = 'https://iap-snailmail.flectrahq.com'
|
||||
@@ -336,7 +337,14 @@ class SnailmailLetter(models.Model):
|
||||
endpoint = self.env['ir.config_parameter'].sudo().get_param('snailmail.endpoint', DEFAULT_ENDPOINT)
|
||||
timeout = int(self.env['ir.config_parameter'].sudo().get_param('snailmail.timeout', DEFAULT_TIMEOUT))
|
||||
params = self._snailmail_create('print')
|
||||
response = iap_tools.iap_jsonrpc(endpoint + PRINT_ENDPOINT, params=params, timeout=timeout)
|
||||
try:
|
||||
response = iap_tools.iap_jsonrpc(endpoint + PRINT_ENDPOINT, params=params, timeout=timeout)
|
||||
except AccessError as ae:
|
||||
for doc in params['documents']:
|
||||
letter = self.browse(doc['letter_id'])
|
||||
letter.state = 'error'
|
||||
letter.error_code = 'UNKNOWN_ERROR'
|
||||
raise ae
|
||||
for doc in response['request']['documents']:
|
||||
if doc.get('sent') and response['request_code'] == 200:
|
||||
note = _('The document was correctly sent by post.<br>The tracking id is %s', doc['send_id'])
|
||||
|
||||
@@ -195,20 +195,7 @@ class StockMoveLine(models.Model):
|
||||
mls = super().create(vals_list)
|
||||
|
||||
def create_move(move_line):
|
||||
new_move = self.env['stock.move'].create({
|
||||
'name': _('New Move:') + move_line.product_id.display_name,
|
||||
'product_id': move_line.product_id.id,
|
||||
'product_uom_qty': 0 if move_line.picking_id and move_line.picking_id.state != 'done' else move_line.qty_done,
|
||||
'product_uom': move_line.product_uom_id.id,
|
||||
'description_picking': move_line.description_picking,
|
||||
'location_id': move_line.picking_id.location_id.id,
|
||||
'location_dest_id': move_line.picking_id.location_dest_id.id,
|
||||
'picking_id': move_line.picking_id.id,
|
||||
'state': move_line.picking_id.state,
|
||||
'picking_type_id': move_line.picking_id.picking_type_id.id,
|
||||
'restrict_partner_id': move_line.picking_id.owner_id.id,
|
||||
'company_id': move_line.picking_id.company_id.id,
|
||||
})
|
||||
new_move = self.env['stock.move'].create(move_line._prepare_stock_move_vals())
|
||||
move_line.move_id = new_move.id
|
||||
|
||||
# If the move line is directly create on the picking view.
|
||||
@@ -689,3 +676,21 @@ class StockMoveLine(models.Model):
|
||||
def _compute_sale_price(self):
|
||||
# To Override
|
||||
pass
|
||||
|
||||
@api.model
|
||||
def _prepare_stock_move_vals(self):
|
||||
self.ensure_one()
|
||||
return {
|
||||
'name': _('New Move:') + self.product_id.display_name,
|
||||
'product_id': self.product_id.id,
|
||||
'product_uom_qty': 0 if self.picking_id and self.picking_id.state != 'done' else self.qty_done,
|
||||
'product_uom': self.product_uom_id.id,
|
||||
'description_picking': self.description_picking,
|
||||
'location_id': self.picking_id.location_id.id,
|
||||
'location_dest_id': self.picking_id.location_dest_id.id,
|
||||
'picking_id': self.picking_id.id,
|
||||
'state': self.picking_id.state,
|
||||
'picking_type_id': self.picking_id.picking_type_id.id,
|
||||
'restrict_partner_id': self.picking_id.owner_id.id,
|
||||
'company_id': self.picking_id.company_id.id,
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ const FormEditor = options.Class.extend({
|
||||
* @returns {string} The new ID
|
||||
*/
|
||||
_generateUniqueID() {
|
||||
return Math.random().toString(36).substring(2, 15);
|
||||
return `o${Math.random().toString(36).substring(2, 15)}`;
|
||||
},
|
||||
/**
|
||||
* Returns a field object
|
||||
|
||||
Reference in New Issue
Block a user