initial odoo 19 changes

This commit is contained in:
admin.suherdy 2025-11-12 16:00:05 +07:00
parent 3328179534
commit f7ffb8b16d
28 changed files with 469 additions and 462 deletions

View File

@ -1,6 +1,6 @@
{ {
'name': 'Purchase Advance Payment', 'name': 'Purchase Advance Payment',
'version': '17.0.1.0.0', 'version': '19.0.1.0.0',
'category': 'Purchase', 'category': 'Purchase',
'summary': 'Link payments to purchase orders as advance payments', 'summary': 'Link payments to purchase orders as advance payments',
'description': """ 'description': """

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -25,13 +25,13 @@
</field> </field>
</record> </record>
<!-- Account Payment Tree View --> <!-- Account Payment List View -->
<record id="view_account_payment_tree_inherit_advance_payment" model="ir.ui.view"> <record id="view_account_payment_tree_inherit_advance_payment" model="ir.ui.view">
<field name="name">account.payment.tree.inherit.advance.payment</field> <field name="name">account.payment.tree.inherit.advance.payment</field>
<field name="model">account.payment</field> <field name="model">account.payment</field>
<field name="inherit_id" ref="account.view_account_payment_tree"/> <field name="inherit_id" ref="account.view_account_payment_tree"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//tree/field[@name='partner_id']" position="after"> <xpath expr="//list/field[@name='partner_id']" position="after">
<field name="purchase_order_id"/> <field name="purchase_order_id"/>
</xpath> </xpath>
</field> </field>

View File

@ -29,21 +29,21 @@
string="Link Advance Payment" string="Link Advance Payment"
type="action" type="action"
class="btn-secondary" class="btn-secondary"
context="{'default_purchase_order_id': active_id}"/> context="{'default_purchase_order_id': id}"/>
</group> </group>
<field name="advance_payment_ids"> <field name="advance_payment_ids">
<tree> <list>
<field name="name"/> <field name="name"/>
<field name="date"/> <field name="date"/>
<field name="amount" widget="monetary"/> <field name="amount" widget="monetary"/>
<field name="state"/> <field name="state"/>
<field name="journal_id"/> <field name="journal_id"/>
</tree> </list>
</field> </field>
</page> </page>
</xpath> </xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='price_unit']" position="after"> <xpath expr="//field[@name='order_line']/list/field[@name='price_unit']" position="after">
<field name="is_deposit" invisible="1"/> <field name="is_deposit" invisible="1"/>
</xpath> </xpath>

Binary file not shown.

Binary file not shown.

View File

@ -30,15 +30,22 @@ class LinkAdvancePaymentWizard(models.TransientModel):
def default_get(self, fields): def default_get(self, fields):
res = super().default_get(fields) res = super().default_get(fields)
# Handle context from purchase order # Handle context from purchase order
if self._context.get('active_model') == 'purchase.order' and self._context.get('active_id'): if self.env.context.get('active_model') == 'purchase.order' and self.env.context.get('active_id'):
po = self.env['purchase.order'].browse(self._context['active_id']) po = self.env['purchase.order'].browse(self.env.context['active_id'])
res['purchase_order_id'] = po.id res['purchase_order_id'] = po.id
res['currency_id'] = po.currency_id.id res['currency_id'] = po.currency_id.id
if 'amount' in fields: if 'amount' in fields:
res['amount'] = po.amount_residual res['amount'] = po.amount_residual
# Handle context from purchase order when called from the button (using default_purchase_order_id)
elif self.env.context.get('default_purchase_order_id'):
po = self.env['purchase.order'].browse(self.env.context['default_purchase_order_id'])
res['purchase_order_id'] = po.id
res['currency_id'] = po.currency_id.id
if 'amount' in fields and 'amount' not in res:
res['amount'] = po.amount_residual
# Handle context from payment # Handle context from payment
elif self._context.get('active_model') == 'account.payment' and self._context.get('active_id'): elif self.env.context.get('active_model') == 'account.payment' and self.env.context.get('active_id'):
payment = self.env['account.payment'].browse(self._context['active_id']) payment = self.env['account.payment'].browse(self.env.context['active_id'])
res['payment_id'] = payment.id res['payment_id'] = payment.id
res['currency_id'] = payment.currency_id.id res['currency_id'] = payment.currency_id.id
if 'amount' in fields: if 'amount' in fields: