mirror of
https://gitlab.com/flectra-hq/flectra.git
synced 2025-02-25 18:55:21 -06:00
[PATCH] Upstream patch - 04102023
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
<separator/>
|
||||
<filter string="Trailing 12 months" name="completion_date" domain="[
|
||||
('date', '>=', (datetime.datetime.combine(context_today() + relativedelta(days=-365), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S')),
|
||||
('date', '>=', (datetime.datetime.combine(context_today(), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S'))]"/>
|
||||
('date', '<=', (datetime.datetime.combine(context_today(), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S'))]"/>
|
||||
<separator/>
|
||||
<filter name="filter_date" date="date"/>
|
||||
<separator/>
|
||||
|
||||
@@ -1528,7 +1528,7 @@ class MailThread(models.AbstractModel):
|
||||
if partner and partner.email: # complete profile: id, name <email>
|
||||
result[self.ids[0]].append((partner.id, partner.email_formatted, reason))
|
||||
elif partner: # incomplete profile: id, name
|
||||
result[self.ids[0]].append((partner.id, partner.name, reason))
|
||||
result[self.ids[0]].append((partner.id, partner.name or '', reason))
|
||||
else: # unknown partner, we are probably managing an email address
|
||||
result[self.ids[0]].append((False, partner_info.get('full_name') or email, reason))
|
||||
return result
|
||||
|
||||
@@ -256,6 +256,7 @@ class MrpUnbuild(models.Model):
|
||||
'warehouse_id': location_dest_id.get_warehouse().id,
|
||||
'unbuild_id': self.id,
|
||||
'company_id': move.company_id.id,
|
||||
'origin_returned_move_id': move.id,
|
||||
})
|
||||
|
||||
def _generate_move_from_bom_line(self, product, product_uom, quantity, bom_line_id=False, byproduct_id=False):
|
||||
|
||||
@@ -86,6 +86,28 @@ class TestMrpValuationStandard(TestMrpValuationCommon):
|
||||
self._make_out_move(self.product1, 1)
|
||||
self.assertEqual(self.product1.value_svl, 15)
|
||||
|
||||
def test_fifo_unbuild(self):
|
||||
""" This test creates an MO and then creates an unbuild
|
||||
orders and checks the stock valuation.
|
||||
"""
|
||||
self.component.product_tmpl_id.categ_id.property_cost_method = 'fifo'
|
||||
# ---------------------------------------------------
|
||||
# MO
|
||||
# ---------------------------------------------------
|
||||
self._make_in_move(self.component, 1, 10)
|
||||
self._make_in_move(self.component, 1, 20)
|
||||
mo = self._make_mo(self.bom, 1)
|
||||
self._produce(mo)
|
||||
mo.button_mark_done()
|
||||
self.assertEqual(self.component.value_svl, 20)
|
||||
# ---------------------------------------------------
|
||||
# Unbuild
|
||||
# ---------------------------------------------------
|
||||
unbuild_form = Form(self.env['mrp.unbuild'])
|
||||
unbuild_form.mo_id = mo
|
||||
unbuild_form.save().action_unbuild()
|
||||
self.assertEqual(self.component.value_svl, 30)
|
||||
|
||||
def test_fifo_avco_1(self):
|
||||
self.component.product_tmpl_id.categ_id.property_cost_method = 'fifo'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'average'
|
||||
|
||||
Reference in New Issue
Block a user