mirror of
https://github.com/Kalenis/kalenislims.git
synced 2023-12-14 07:13:04 +01:00
lims_quality_control: add uom to countersample wizard
This commit is contained in:
parent
c099d00d62
commit
5b98c4e229
3 changed files with 34 additions and 4 deletions
|
@ -30,10 +30,18 @@ msgctxt "field:lims.countersample.create.start,location:"
|
||||||
msgid "Location"
|
msgid "Location"
|
||||||
msgstr "Ubicación Destino"
|
msgstr "Ubicación Destino"
|
||||||
|
|
||||||
|
msgctxt "field:lims.countersample.create.start,product_uom_category:"
|
||||||
|
msgid "Product Uom Category"
|
||||||
|
msgstr "Categoría UdM del producto"
|
||||||
|
|
||||||
msgctxt "field:lims.countersample.create.start,quantity:"
|
msgctxt "field:lims.countersample.create.start,quantity:"
|
||||||
msgid "Quantity"
|
msgid "Quantity"
|
||||||
msgstr "Cantidad"
|
msgstr "Cantidad"
|
||||||
|
|
||||||
|
msgctxt "field:lims.countersample.create.start,unit:"
|
||||||
|
msgid "UoM"
|
||||||
|
msgstr "UdM"
|
||||||
|
|
||||||
msgctxt "field:lims.create.quality.test.start,date:"
|
msgctxt "field:lims.create.quality.test.start,date:"
|
||||||
msgid "Date"
|
msgid "Date"
|
||||||
msgstr "Fecha"
|
msgstr "Fecha"
|
||||||
|
|
|
@ -229,7 +229,15 @@ class CountersampleCreateStart(ModelView):
|
||||||
__name__ = 'lims.countersample.create.start'
|
__name__ = 'lims.countersample.create.start'
|
||||||
|
|
||||||
location = fields.Many2One('stock.location', 'Location', required=True)
|
location = fields.Many2One('stock.location', 'Location', required=True)
|
||||||
quantity = fields.Float('Quantity')
|
quantity = fields.Float('Quantity', required=True)
|
||||||
|
unit = fields.Many2One('product.uom', 'UoM', required=True,
|
||||||
|
domain=[
|
||||||
|
('category', '=', Eval('product_uom_category')),
|
||||||
|
('factor', '<=', Eval('product_factor')),
|
||||||
|
])
|
||||||
|
product_uom_category = fields.Many2One('product.uom.category',
|
||||||
|
'Product Uom Category')
|
||||||
|
product_factor = fields.Float("Factor", digits=(12, 12))
|
||||||
comments = fields.Text('Comments')
|
comments = fields.Text('Comments')
|
||||||
countersamples = fields.Many2Many(
|
countersamples = fields.Many2Many(
|
||||||
'lims.sample', None, None, 'Countersamples')
|
'lims.sample', None, None, 'Countersamples')
|
||||||
|
@ -248,6 +256,14 @@ class CountersampleCreate(Wizard):
|
||||||
create_ = StateTransition()
|
create_ = StateTransition()
|
||||||
open_ = StateAction('lims_quality_control.act_lims_sample_list')
|
open_ = StateAction('lims_quality_control.act_lims_sample_list')
|
||||||
|
|
||||||
|
def default_ask(self, fields):
|
||||||
|
Sample = Pool().get('lims.sample')
|
||||||
|
res = {}
|
||||||
|
sample = Sample(Transaction().context['active_id'])
|
||||||
|
res['product_uom_category'] = sample.product.default_uom_category.id
|
||||||
|
res['product_factor'] = sample.product.default_uom.factor
|
||||||
|
return res
|
||||||
|
|
||||||
def transition_start(self):
|
def transition_start(self):
|
||||||
Sample = Pool().get('lims.sample')
|
Sample = Pool().get('lims.sample')
|
||||||
|
|
||||||
|
@ -319,7 +335,8 @@ class CountersampleCreate(Wizard):
|
||||||
}
|
}
|
||||||
new_fraction, = Fraction.create([fraction_default])
|
new_fraction, = Fraction.create([fraction_default])
|
||||||
|
|
||||||
moves = self._get_stock_moves([new_fraction], self.ask.quantity)
|
moves = self._get_stock_moves([new_fraction],
|
||||||
|
self.ask.quantity, self.ask.unit)
|
||||||
Move.do(moves)
|
Move.do(moves)
|
||||||
countersamples.append(new_countersample)
|
countersamples.append(new_countersample)
|
||||||
|
|
||||||
|
@ -334,7 +351,7 @@ class CountersampleCreate(Wizard):
|
||||||
'res_id': [self.ask.countersamples[0].id],
|
'res_id': [self.ask.countersamples[0].id],
|
||||||
}
|
}
|
||||||
|
|
||||||
def _get_stock_moves(self, fractions, quantity):
|
def _get_stock_moves(self, fractions, quantity, unit):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
User = pool.get('res.user')
|
User = pool.get('res.user')
|
||||||
Move = pool.get('stock.move')
|
Move = pool.get('stock.move')
|
||||||
|
@ -349,7 +366,7 @@ class CountersampleCreate(Wizard):
|
||||||
move.lot = fraction.sample.lot.id
|
move.lot = fraction.sample.lot.id
|
||||||
move.fraction = fraction.id
|
move.fraction = fraction.id
|
||||||
move.quantity = quantity or 1
|
move.quantity = quantity or 1
|
||||||
move.uom = fraction.sample.lot.product.default_uom
|
move.uom = unit
|
||||||
move.from_location = \
|
move.from_location = \
|
||||||
fraction.sample.countersample_original_sample.fractions[
|
fraction.sample.countersample_original_sample.fractions[
|
||||||
0].storage_location.id
|
0].storage_location.id
|
||||||
|
|
|
@ -2,8 +2,13 @@
|
||||||
<form>
|
<form>
|
||||||
<label name="location"/>
|
<label name="location"/>
|
||||||
<field name="location"/>
|
<field name="location"/>
|
||||||
|
<newline/>
|
||||||
<label name="quantity"/>
|
<label name="quantity"/>
|
||||||
<field name="quantity"/>
|
<field name="quantity"/>
|
||||||
|
<label name="unit"/>
|
||||||
|
<field name="unit"/>
|
||||||
|
<field name="product_uom_category" invisible="1"/>
|
||||||
|
<field name="product_factor" invisible="1"/>
|
||||||
<separator id="comments" string="Comments" colspan="4"/>
|
<separator id="comments" string="Comments" colspan="4"/>
|
||||||
<field name="comments" colspan="4"/>
|
<field name="comments" colspan="4"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in a new issue